From: Anders Carlsson Date: Sat, 16 May 2009 22:05:23 +0000 (+0000) Subject: Fix another case where the extern-ness of extern "C" wasn't being captured. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=425bfdee21d7ce13799bb7f9d74805a2d5775762;p=clang Fix another case where the extern-ness of extern "C" wasn't being captured. This makes me think that we should make hasExternalStorage perform this check... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71962 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 2847dc1014..c881200d07 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2703,7 +2703,8 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl) { QualType InitType = Type; if (const ArrayType *Array = Context.getAsArrayType(Type)) InitType = Array->getElementType(); - if (!Var->hasExternalStorage() && InitType->isRecordType()) { + if ((!Var->hasExternalStorage() && !Var->isExternC(Context)) && + InitType->isRecordType()) { CXXRecordDecl *RD = cast(InitType->getAsRecordType()->getDecl()); CXXConstructorDecl *Constructor = 0; diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp index 40f3221667..864953e9f9 100644 --- a/test/SemaCXX/linkage-spec.cpp +++ b/test/SemaCXX/linkage-spec.cpp @@ -21,3 +21,7 @@ extern "C" int foo; extern "C" const int bar; extern "C" int const bar; + +// +extern "C" struct bar d; +extern struct bar e;