diff options
| author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-02-19 12:27:43 +0000 |
|---|---|---|
| committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2012-02-19 12:27:43 +0000 |
| commit | 4f28b58b7bc29b979c3d80e6aaf0e75ce5ffd2a5 (patch) | |
| tree | aa2f5acf44bb55ee1004a10587fd9779183e6aa9 /clang/lib/Sema | |
| parent | c84ded88eaf46193bc85431da8513a57a54da7a5 (diff) | |
| download | bcm5719-llvm-4f28b58b7bc29b979c3d80e6aaf0e75ce5ffd2a5.tar.gz bcm5719-llvm-4f28b58b7bc29b979c3d80e6aaf0e75ce5ffd2a5.zip | |
Fix a crash for nested initializer list initialization. Still does the wrong thing in CodeGen, in that it never destructs anything.
llvm-svn: 150922
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index fb97b00ace4..28b99f9e4c3 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -3078,16 +3078,25 @@ static void TryListInitialization(Sema &S, TryReferenceListInitialization(S, Entity, Kind, InitList, Sequence); return; } - if (DestType->isRecordType() && !DestType->isAggregateType()) { - if (S.getLangOptions().CPlusPlus0x) { - Expr *Arg = InitList; - // A direct-initializer is not list-syntax, i.e. there's no special - // treatment of "A a({1, 2});". - TryConstructorInitialization(S, Entity, Kind, &Arg, 1, DestType, - Sequence, Kind.getKind() != InitializationKind::IK_Direct); - } else - Sequence.SetFailed(InitializationSequence::FK_InitListBadDestinationType); - return; + if (DestType->isRecordType()) { + if (S.RequireCompleteType(InitList->getLocStart(), DestType, S.PDiag())) { + Sequence.SetFailed(InitializationSequence::FK_Incomplete); + return; + } + + if (!DestType->isAggregateType()) { + if (S.getLangOptions().CPlusPlus0x) { + Expr *Arg = InitList; + // A direct-initializer is not list-syntax, i.e. there's no special + // treatment of "A a({1, 2});". + TryConstructorInitialization(S, Entity, Kind, &Arg, 1, DestType, + Sequence, + Kind.getKind() != InitializationKind::IK_Direct); + } else + Sequence.SetFailed( + InitializationSequence::FK_InitListBadDestinationType); + return; + } } InitListChecker CheckInitList(S, Entity, InitList, |

