[cfe-commits] r150922 - /cfe/trunk/lib/Sema/SemaInit.cpp
Sebastian Redl
sebastian.redl at getdesigned.at
Sun Feb 19 04:27:43 PST 2012
Author: cornedbee
Date: Sun Feb 19 06:27:43 2012
New Revision: 150922
URL: http://llvm.org/viewvc/llvm-project?rev=150922&view=rev
Log:
Fix a crash for nested initializer list initialization. Still does the wrong thing in CodeGen, in that it never destructs anything.
Modified:
cfe/trunk/lib/Sema/SemaInit.cpp
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=150922&r1=150921&r2=150922&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Sun Feb 19 06:27:43 2012
@@ -3078,16 +3078,25 @@
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,
More information about the cfe-commits
mailing list