aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-04-19 21:31:25 +0000
committerDouglas Gregor <dgregor@apple.com>2010-04-19 21:31:25 +0000
commit41b1d6ba40a5c856f3d0bfed1b825154f87b6127 (patch)
tree85a89f350763c98151828958f0cd19f75d396f19 /lib/Sema/SemaDecl.cpp
parent8d8ab749f6f8bb63ea2cd2b589c0f050b67fc5cc (diff)
Disable the "'extern' variable has an initializer" warning in C++,
since it makes sense there to have const extern variables. Fixes PR6495. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 182a85aee8..045b3e8c38 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3818,7 +3818,8 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
}
}
} else if (VDecl->isFileVarDecl()) {
- if (VDecl->getStorageClass() == VarDecl::Extern)
+ if (VDecl->getStorageClass() == VarDecl::Extern &&
+ !getLangOptions().CPlusPlus)
Diag(VDecl->getLocation(), diag::warn_extern_init);
if (!VDecl->isInvalidDecl()) {
InitializationSequence InitSeq(*this, Entity, Kind, &Init, 1);