summaryrefslogtreecommitdiffstats
path: root/clang/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
commita72ddd4609551640fb3d9b28553da196b2266c97 (patch)
treef546c6d7725e2a858c33c5150f7bfb456d4ee935 /clang/lib/CodeGen/CGDeclCXX.cpp
parent364051c6a6955f55b0052276e6e0c3660936ee10 (diff)
downloadbcm5719-llvm-a72ddd4609551640fb3d9b28553da196b2266c97.tar.gz
bcm5719-llvm-a72ddd4609551640fb3d9b28553da196b2266c97.zip
Handle emitting static variables that have reference type.
llvm-svn: 91027
Diffstat (limited to 'clang/lib/CodeGen/CGDeclCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGDeclCXX.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index 44038da7d18..d240a3b933f 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud