]> granicus.if.org Git - clang/commitdiff
Don't assert that linkage decls are always C++, it's not true. Fixes PR5019.
authorAnders Carlsson <andersca@mac.com>
Tue, 22 Sep 2009 17:23:30 +0000 (17:23 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 22 Sep 2009 17:23:30 +0000 (17:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82557 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Mangle.cpp
test/CodeGenCXX/mangle.cpp

index 973f0d188cb01d54103df3f2445df806acd37c17..5a994d2234b272f9242b1f4dcbca28aaa8a7919f 100644 (file)
@@ -279,11 +279,8 @@ void CXXNameMangler::mangleName(const NamedDecl *ND) {
   //         ::= <local-name>
   //
   const DeclContext *DC = ND->getDeclContext();
-  while (isa<LinkageSpecDecl>(DC)) {
-    assert(cast<LinkageSpecDecl>(DC)->getLanguage() == 
-           LinkageSpecDecl::lang_cxx && "Unexpected linkage decl!");
+  while (isa<LinkageSpecDecl>(DC))
     DC = DC->getParent();
-  }
   
   if (DC->isTranslationUnit() || isStdNamespace(DC)) {
     // Check if we have a template.
index d952f314397dd87572488b7304e602e41ac39144..dbcd0c9460d72eb8f519b4640087e33d84b7eb57 100644 (file)
@@ -130,3 +130,10 @@ extern "C++" {
  void h() { } 
 }
 
+// PR5019
+extern "C" { struct a { int b; }; }
+
+// CHECK: @_Z1fP1a
+int f(struct a *x) {
+    return x->b;
+}