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 2847dc1..c881200 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2703,7 +2703,8 @@
       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;
diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp
index 40f3221..864953e 100644
--- a/test/SemaCXX/linkage-spec.cpp
+++ b/test/SemaCXX/linkage-spec.cpp
@@ -21,3 +21,7 @@
 
 extern "C" const int bar;
 extern "C" int const bar;
+
+// <rdar://problem/6895431>
+extern "C" struct bar d;
+extern struct bar e;