diff options
author | Faisal Vali <faisalv@yahoo.com> | 2015-12-07 02:37:44 +0000 |
---|---|---|
committer | Faisal Vali <faisalv@yahoo.com> | 2015-12-07 02:37:44 +0000 |
commit | 30622bb6a56ae40dd5c912b74ddb88e5cdfd0f5a (patch) | |
tree | 475acb2d337ba05f06bda43e99067a58e995dffd /clang/lib/Sema/SemaInit.cpp | |
parent | c74277a2d91db8a2052c6ea78c4513fb95d9bb74 (diff) | |
download | bcm5719-llvm-30622bb6a56ae40dd5c912b74ddb88e5cdfd0f5a.tar.gz bcm5719-llvm-30622bb6a56ae40dd5c912b74ddb88e5cdfd0f5a.zip |
Fix PR20334: invalid assertion while diagnosing list initialization failure
https://llvm.org/bugs/show_bug.cgi?id=20334
Unfortunately, clang currently checks for a certain brokenness of implementations of std::initializer_list in CodeGen (void
AggExprEmitter::VisitCXXStdInitializerListExpr), not in SemaInit. Until that is fixed, make sure we don't let broken attempts that are aggregates leak through into sema, which allows maintenance of expected invariants, and avoids triggering an assertion.
llvm-svn: 254889
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 89d253981c5..0f60ad10a3e 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -3732,7 +3732,9 @@ static void TryListInitialization(Sema &S, // C++11 [dcl.init.list]p3: // - If T is an aggregate, aggregate initialization is performed. - if (DestType->isRecordType() && !DestType->isAggregateType()) { + if ((DestType->isRecordType() && !DestType->isAggregateType()) || + (S.getLangOpts().CPlusPlus11 && + S.isStdInitializerList(DestType, nullptr))) { if (S.getLangOpts().CPlusPlus11) { // - Otherwise, if the initializer list has no elements and T is a // class type with a default constructor, the object is |