From 425bfdee21d7ce13799bb7f9d74805a2d5775762 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 16 May 2009 22:05:23 +0000 Subject: [PATCH] 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 --- lib/Sema/SemaDecl.cpp | 3 ++- test/SemaCXX/linkage-spec.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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; -- 2.40.0