diff options
author | Anders Carlsson <andersca@mac.com> | 2009-12-10 01:05:11 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-12-10 01:05:11 +0000 |
commit | a72ddd4609551640fb3d9b28553da196b2266c97 (patch) | |
tree | f546c6d7725e2a858c33c5150f7bfb456d4ee935 /clang/lib/CodeGen/CGDeclCXX.cpp | |
parent | 364051c6a6955f55b0052276e6e0c3660936ee10 (diff) | |
download | bcm5719-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.cpp | 5 |
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); |