diff options
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 6 | ||||
-rw-r--r-- | test/SemaCXX/storage-class.cpp | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 8fce6393c6..c9001f1030 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3856,7 +3856,8 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) { } } else if (VDecl->isFileVarDecl()) { if (VDecl->getStorageClass() == VarDecl::Extern && - (!getLangOptions().CPlusPlus || !VDecl->getType().isConstQualified())) + (!getLangOptions().CPlusPlus || + !Context.getBaseElementType(VDecl->getType()).isConstQualified())) Diag(VDecl->getLocation(), diag::warn_extern_init); if (!VDecl->isInvalidDecl()) { InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1); @@ -5667,6 +5668,9 @@ void Sema::DiagnoseNontrivial(const RecordType* T, CXXSpecialMember member) { // Check whether the member was user-declared. switch (member) { + case CXXInvalid: + break; + case CXXConstructor: if (RD->hasUserDeclaredConstructor()) { typedef CXXRecordDecl::ctor_iterator ctor_iter; diff --git a/test/SemaCXX/storage-class.cpp b/test/SemaCXX/storage-class.cpp index 4025595de1..a2e206323a 100644 --- a/test/SemaCXX/storage-class.cpp +++ b/test/SemaCXX/storage-class.cpp @@ -1,3 +1,4 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s extern const int PR6495a = 42; extern int PR6495b = 42; // expected-warning{{'extern' variable has an initializer}} +extern const int PR6495c[] = {42,43,44}; |