diff options
-rw-r--r-- | clang/lib/AST/Decl.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/const-global-linkage.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index b52c7ada7f3..572d76ff72d 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -232,7 +232,7 @@ static NamedDecl::Linkage getLinkageForNamespaceScopeDecl(const NamedDecl *D) { // declared to have external linkage; or // (there is no equivalent in C99) if (Context.getLangOptions().CPlusPlus && - Var->getType().isConstQualified() && + Var->getType().isConstant(Context) && Var->getStorageClass() != VarDecl::Extern && Var->getStorageClass() != VarDecl::PrivateExtern) { bool FoundExtern = false; diff --git a/clang/test/CodeGenCXX/const-global-linkage.cpp b/clang/test/CodeGenCXX/const-global-linkage.cpp index ddf435823ba..f12c569d942 100644 --- a/clang/test/CodeGenCXX/const-global-linkage.cpp +++ b/clang/test/CodeGenCXX/const-global-linkage.cpp @@ -6,3 +6,8 @@ const int y = 20; // CHECK: @y = internal constant i32 20 const int& b() { return y; } +const char z1[] = "asdf"; +const char z2[] = "zxcv"; +// CHECK-NOT: @z1 +// CHECK: @z2 = internal constant +const char* b2() { return z2; } |