diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-10-15 01:21:46 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-10-15 01:21:46 +0000 |
commit | 66c42d443982a0891ce58deb7391d641ca87adc5 (patch) | |
tree | eb060dfd5ea993fa9e660003587446eb10ff1773 | |
parent | 99ea7343ce6d23157427a59eaf969596e8ed609f (diff) |
Don't complain about a variable within a linkage-specification that is
initialized. Fixes PR7076.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116553 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/linkage-spec.cpp | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 93909f995d..4a834cd560 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -4339,7 +4339,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { } } } else if (VDecl->isFileVarDecl()) { - if (VDecl->getStorageClass() == SC_Extern && + if (VDecl->getStorageClassAsWritten() == SC_Extern && (!getLangOptions().CPlusPlus || !Context.getBaseElementType(VDecl->getType()).isConstQualified())) Diag(VDecl->getLocation(), diag::warn_extern_init); diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp index 86c3d3e87a..b5a10a795e 100644 --- a/test/SemaCXX/linkage-spec.cpp +++ b/test/SemaCXX/linkage-spec.cpp @@ -86,3 +86,6 @@ namespace N { } extern "C++" using N::value; + +// PR7076 +extern "C" const char *Version_string = "2.9"; |