From 864143fe14b8059eed1413d38854b689f7b21016 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 10 Dec 2009 01:58:33 +0000 Subject: [PATCH] Actually store the pointer into the global variable, spotted by Eli. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91036 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDeclCXX.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index d240a3b933..0b6ea5a834 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/lib/CodeGen/CGDeclCXX.cpp @@ -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); -- 2.40.0