aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-30 22:09:00 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-30 22:09:00 +0000
commit930d8b5ecc074cca01ecd9a522a55f55f3b72396 (patch)
treeb0774830aea132c8806e973c2b8038d220d8483f /lib/Sema/SemaDecl.cpp
parent0f6610e41701e7d7a9b65c52e1a0926530ac3ce1 (diff)
Implement and test aggregate initialization in C++. Major changes:
- Support initialization of reference members; complain if any reference members are left uninitialized. - Use C++ copy-initialization for initializing each element (falls back to constraint checking in C) - Make sure we diagnose when one tries to provide an initializer list for a non-aggregate. - Don't complain about empty initializers in C++ (they are permitted) - Unrelated but necessary: don't bother trying to convert the decl-specifier-seq to a type when we're dealing with a C++ constructor, destructor, or conversion operator; it results in spurious warnings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63431 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp18
1 files changed, 1 insertions, 17 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 3395313f84..5dd45fb072 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1074,23 +1074,7 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
<< Init->getSourceRange();
return CheckSingleInitializer(Init, DeclType, DirectInit);
- } else if (getLangOptions().CPlusPlus) {
- // C++ [dcl.init]p14:
- // [...] If the class is an aggregate (8.5.1), and the initializer
- // is a brace-enclosed list, see 8.5.1.
- //
- // Note: 8.5.1 is handled below; here, we diagnose the case where
- // we have an initializer list and a destination type that is not
- // an aggregate.
- // FIXME: In C++0x, this is yet another form of initialization.
- // FIXME: Move this checking into CheckInitList!
- if (const RecordType *ClassRec = DeclType->getAsRecordType()) {
- const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(ClassRec->getDecl());
- if (!ClassDecl->isAggregate())
- return Diag(InitLoc, diag::err_init_non_aggr_init_list)
- << DeclType << Init->getSourceRange();
- }
- }
+ }
bool hadError = CheckInitList(InitList, DeclType);
Init = InitList;