Be smarter in discovering list-initialization of temporaries. Fixes PR12182.

llvm-svn: 152231
This commit is contained in:
Sebastian Redl 2012-03-07 16:10:45 +00:00
parent 5c0e7190ff
commit e0691eae7d
2 changed files with 9 additions and 1 deletions

View File

@ -5110,7 +5110,7 @@ InitializationSequence::Perform(Sema &S,
// unwrap references here and rewrap them afterwards.
// We also need to create a InitializeTemporary entity for this.
QualType Ty = ResultType ? ResultType->getNonReferenceType() : Step->Type;
bool IsTemporary = ResultType && (*ResultType)->isReferenceType();
bool IsTemporary = Entity.getType()->isReferenceType();
InitializedEntity TempEntity = InitializedEntity::InitializeTemporary(Ty);
InitListChecker PerformInitList(S, IsTemporary ? TempEntity : Entity,
InitList, Ty, /*VerifyOnly=*/false,

View File

@ -77,3 +77,11 @@ namespace reference {
}
}
namespace PR12182 {
void f(int const(&)[3]);
void g() {
f({1, 2});
}
}