From: Rafael Espindola Date: Tue, 12 Mar 2013 15:06:22 +0000 (+0000) Subject: Remove a bogus assert so we don't crash in X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6c18af24456000e4b7289bc024519efdb796229a;p=clang Remove a bogus assert so we don't crash in namespace { struct X {}; } extern "C" { X b = X(); } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176866 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 0b0da40550..b55a926e32 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -7629,8 +7629,6 @@ GVALinkage ASTContext::GetGVALinkageForVariable(const VarDecl *VD) { TSK = VD->getTemplateSpecializationKind(); Linkage L = VD->getLinkage(); - assert (!(L == ExternalLinkage && getLangOpts().CPlusPlus && - VD->getType()->getLinkage() == UniqueExternalLinkage)); switch (L) { case NoLinkage: diff --git a/test/CodeGenCXX/extern-c.cpp b/test/CodeGenCXX/extern-c.cpp index ca5cd7372c..794171b426 100644 --- a/test/CodeGenCXX/extern-c.cpp +++ b/test/CodeGenCXX/extern-c.cpp @@ -1,16 +1,28 @@ -// RUN: %clang_cc1 -emit-llvm %s -o %t +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s namespace foo { -// RUN: not grep "@a = global i32" %t +// CHECK-NOT: @a = global i32 extern "C" int a; -// RUN: not grep "@_ZN3foo1bE = global i32" %t +// CHECK-NOT: @_ZN3foo1bE = global i32 extern int b; -// RUN: grep "@_ZN3foo1cE = global i32" %t | count 1 +// CHECK: @_ZN3foo1cE = global i32 int c = 5; -// RUN: not grep "@_ZN3foo1dE" %t +// CHECK-NOT: @_ZN3foo1dE extern "C" struct d; } + +namespace test1 { + namespace { + struct X {}; + } + extern "C" { + // CHECK: @b = global + X b = X(); + } + void *use = &b; + // CHECK: @_ZN5test13useE = global +}