diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-19 22:34:40 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-19 22:34:40 +0000 |
commit | 63c323d7584e3d91549fae23fb30b426d3b19042 (patch) | |
tree | abbdd5140670584c78511840546256ad5b761d1b /lib/Sema/SemaDecl.cpp | |
parent | 41b1d6ba40a5c856f3d0bfed1b825154f87b6127 (diff) |
Only suppress the "extern variable has an initializer" warning when the extern entity being initialized is const.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 045b3e8c38..115b7bf756 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3819,7 +3819,7 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) { } } else if (VDecl->isFileVarDecl()) { if (VDecl->getStorageClass() == VarDecl::Extern && - !getLangOptions().CPlusPlus) + (!getLangOptions().CPlusPlus || !VDecl->getType().isConstQualified())) Diag(VDecl->getLocation(), diag::warn_extern_init); if (!VDecl->isInvalidDecl()) { InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1); |