From 616c1738099ec52e1973197b8b9447df92461d3f Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Mon, 25 Jan 2010 21:40:39 +0000 Subject: [PATCH] global variable that binds reference to a non-lvalue reproted as NYI now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94453 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDeclCXX.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index 2d473de47c..3f1a7225fb 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/lib/CodeGen/CGDeclCXX.cpp @@ -80,8 +80,13 @@ void CodeGenFunction::EmitCXXGlobalVarDeclInit(const VarDecl &D, EmitDeclInit(*this, D, DeclPtr); return; } - RValue RV = EmitReferenceBindingToExpr(Init, T, /*IsInitializer=*/true); - EmitStoreOfScalar(RV.getScalarVal(), DeclPtr, false, T); + if (Init->isLvalue(getContext()) == Expr::LV_Valid) { + RValue RV = EmitReferenceBindingToExpr(Init, T, /*IsInitializer=*/true); + EmitStoreOfScalar(RV.getScalarVal(), DeclPtr, false, T); + return; + } + ErrorUnsupported(Init, + "global variable that binds reference to a non-lvalue"); } void -- 2.50.1