diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-22 14:36:26 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-22 14:36:26 +0000 |
commit | 66dd9394994654b5af2c62ed24f311432bacede5 (patch) | |
tree | f29812b6e320315bed17540c5dcf608051c4956d /lib/Sema/SemaDecl.cpp | |
parent | 050b78acf11900cb8c47563376200a1d7bd97f59 (diff) |
When checking whether to diagnose an initialized "extern" variable,
look for the const on the base type rather than on the top-level
type. Fixes PR6495 properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102066 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 6 |
1 files changed, 5 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; |