forked from OSchip/llvm-project
Be smarter in discovering list-initialization of temporaries. Fixes PR12182.
llvm-svn: 152231
This commit is contained in:
parent
5c0e7190ff
commit
e0691eae7d
|
@ -5110,7 +5110,7 @@ InitializationSequence::Perform(Sema &S,
|
||||||
// unwrap references here and rewrap them afterwards.
|
// unwrap references here and rewrap them afterwards.
|
||||||
// We also need to create a InitializeTemporary entity for this.
|
// We also need to create a InitializeTemporary entity for this.
|
||||||
QualType Ty = ResultType ? ResultType->getNonReferenceType() : Step->Type;
|
QualType Ty = ResultType ? ResultType->getNonReferenceType() : Step->Type;
|
||||||
bool IsTemporary = ResultType && (*ResultType)->isReferenceType();
|
bool IsTemporary = Entity.getType()->isReferenceType();
|
||||||
InitializedEntity TempEntity = InitializedEntity::InitializeTemporary(Ty);
|
InitializedEntity TempEntity = InitializedEntity::InitializeTemporary(Ty);
|
||||||
InitListChecker PerformInitList(S, IsTemporary ? TempEntity : Entity,
|
InitListChecker PerformInitList(S, IsTemporary ? TempEntity : Entity,
|
||||||
InitList, Ty, /*VerifyOnly=*/false,
|
InitList, Ty, /*VerifyOnly=*/false,
|
||||||
|
|
|
@ -77,3 +77,11 @@ namespace reference {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace PR12182 {
|
||||||
|
void f(int const(&)[3]);
|
||||||
|
|
||||||
|
void g() {
|
||||||
|
f({1, 2});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue