]> granicus.if.org Git - clang/commitdiff
Fixes a code gen. bug by removing an assert.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 20 Apr 2010 22:02:31 +0000 (22:02 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 20 Apr 2010 22:02:31 +0000 (22:02 +0000)
It is ok to have c++-ness inside extern "C"
block. Fixes pr6644.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101948 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Mangle.cpp
test/CodeGenCXX/c-linkage.cpp [new file with mode: 0644]

index 85a846841dd6c24eaa5785243be5dde7a564c770..e7257bd8127324d7efb0a792b8538ccf27eac10e 100644 (file)
@@ -306,8 +306,6 @@ static bool isStd(const NamespaceDecl *NS) {
 
 static const DeclContext *IgnoreLinkageSpecDecls(const DeclContext *DC) {
   while (isa<LinkageSpecDecl>(DC)) {
-    assert(cast<LinkageSpecDecl>(DC)->getLanguage() ==
-           LinkageSpecDecl::lang_cxx && "Unexpected linkage decl!");
     DC = DC->getParent();
   }
 
diff --git a/test/CodeGenCXX/c-linkage.cpp b/test/CodeGenCXX/c-linkage.cpp
new file mode 100644 (file)
index 0000000..b1f07b7
--- /dev/null
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// pr6644
+
+extern "C" {
+  namespace N {
+    struct X { 
+      virtual void f();
+    };
+    void X::f() { }
+  }
+}
+
+// CHECK: define void @_ZN1N1X1fEv