Actually store the pointer into the global variable, spotted by Eli.

llvm-svn: 91036
This commit is contained in:
Anders Carlsson 2009-12-10 01:58:33 +00:00
parent 3c6a12ca65
commit fefc7b8e7b
1 changed files with 5 additions and 2 deletions

View File

@ -193,10 +193,13 @@ CodeGenFunction::EmitStaticCXXBlockVarDeclInit(const VarDecl &D,
EmitBlock(InitBlock);
if (D.getType()->isReferenceType()) {
QualType T = D.getType();
// We don't want to pass true for IsInitializer here, because a static
// reference to a temporary does not extend its lifetime.
EmitReferenceBindingToExpr(D.getInit(), D.getType(),
/*IsInitializer=*/false);
RValue RV = EmitReferenceBindingToExpr(D.getInit(), T,
/*IsInitializer=*/false);
EmitStoreOfScalar(RV.getScalarVal(), GV, /*Volatile=*/false, T);
} else
EmitDeclInit(*this, D, GV);