From 340aafaac6c2291ece78d1c31a00ddfccf71ddd3 Mon Sep 17 00:00:00 2001 From: John McCall Date: Mon, 8 Feb 2010 21:46:50 +0000 Subject: Emit global references with constant initializers as constants. Fixes PR5585. The standard actually says that such references should have internal linkage, but gcc doesn't do that, so we probably can't get away with it. llvm-svn: 95577 --- clang/lib/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index c5d84d7..a6b546e 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -783,7 +783,7 @@ CodeGenModule::CreateRuntimeFunction(const llvm::FunctionType *FTy, } static bool DeclIsConstantGlobal(ASTContext &Context, const VarDecl *D) { - if (!D->getType().isConstant(Context)) + if (!D->getType().isConstant(Context) && !D->getType()->isReferenceType()) return false; if (Context.getLangOptions().CPlusPlus && Context.getBaseElementType(D->getType())->getAs()) { -- cgit v1.1