Don't complain about a variable within a linkage-specification that is

initialized. Fixes PR7076.

llvm-svn: 116553
This commit is contained in:
Douglas Gregor 2010-10-15 01:21:46 +00:00
parent 150c3cc825
commit d4e1fb562e
2 changed files with 4 additions and 1 deletions

View File

@ -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);

View File

@ -86,3 +86,6 @@ namespace N {
}
extern "C++" using N::value;
// PR7076
extern "C" const char *Version_string = "2.9";