aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDeclCXX.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-12-10 01:05:11 +0000
committerAnders Carlsson <andersca@mac.com>2009-12-10 01:05:11 +0000
commitc7974ca5312eefd00b9e927203def9fbd8c1d169 (patch)
tree54f2c2e9d64fb548304169679c54f4e586e400c1 /lib/CodeGen/CGDeclCXX.cpp
parentfcbfdc1a93325471a262f0d94461273ae67ad3b6 (diff)
Handle emitting static variables that have reference type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDeclCXX.cpp')
-rw-r--r--lib/CodeGen/CGDeclCXX.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp
index 44038da7d1..d240a3b933 100644
--- a/lib/CodeGen/CGDeclCXX.cpp
+++ b/lib/CodeGen/CGDeclCXX.cpp
@@ -193,7 +193,10 @@ CodeGenFunction::EmitStaticCXXBlockVarDeclInit(const VarDecl &D,
EmitBlock(InitBlock);
if (D.getType()->isReferenceType()) {
- ErrorUnsupported(D.getInit(), "static variable that binds to a reference");
+ // 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);
} else
EmitDeclInit(*this, D, GV);