Remove a bogus assert so we don't crash in

namespace {
  struct X {};
}
extern "C" {
  X b = X();
}

llvm-svn: 176866
This commit is contained in:
Rafael Espindola 2013-03-12 15:06:22 +00:00
parent e154c8f23e
commit b3f4b978bb
2 changed files with 17 additions and 7 deletions

View File

@ -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:

View File

@ -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
}