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
This commit is contained in:
John McCall
2010-02-08 21:46:50 +00:00
parent d0450d90b3
commit 340aafaac6
2 changed files with 3 additions and 3 deletions

View File

@@ -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<RecordType>()) {