]> granicus.if.org Git - clang/commitdiff
Fix another case where the extern-ness of extern "C" wasn't being captured.
authorAnders Carlsson <andersca@mac.com>
Sat, 16 May 2009 22:05:23 +0000 (22:05 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 16 May 2009 22:05:23 +0000 (22:05 +0000)
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
test/SemaCXX/linkage-spec.cpp

index 2847dc10143937da1fcde71f67b971bc8d6c80f2..c881200d07f24e14e413be8397bb0b2428319668 100644 (file)
@@ -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<CXXRecordDecl>(InitType->getAsRecordType()->getDecl());
         CXXConstructorDecl *Constructor = 0;
index 40f3221667af76bbf28d0b106d2c2b6e98580ca9..864953e9f9c2fb320fcbcfb0fb0d3c0abc389963 100644 (file)
@@ -21,3 +21,7 @@ extern "C" int foo;
 
 extern "C" const int bar;
 extern "C" int const bar;
+
+// <rdar://problem/6895431>
+extern "C" struct bar d;
+extern struct bar e;