]> granicus.if.org Git - clang/commitdiff
Actually store the pointer into the global variable, spotted by Eli.
authorAnders Carlsson <andersca@mac.com>
Thu, 10 Dec 2009 01:58:33 +0000 (01:58 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 10 Dec 2009 01:58:33 +0000 (01:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91036 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDeclCXX.cpp

index d240a3b933f68df7f96f9da93a70735548232c67..0b6ea5a834b1a07cc22127ce1836317cf7e57b3e 100644 (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);