From 4bbab92167713bf4f79c0b14dcc4e83d08ac4019 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Wed, 20 May 2009 00:36:58 +0000 Subject: Bind references to lvalues correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72150 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index dc447983f0..bb9f20003a 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -72,6 +72,12 @@ RValue CodeGenFunction::EmitAnyExprToTemp(const Expr *E, llvm::Value *AggLoc, RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E, QualType DestType) { + if (E->isLvalue(getContext()) == Expr::LV_Valid) { + // Emit the expr as an lvalue. + LValue LV = EmitLValue(E); + return RValue::get(LV.getAddress()); + } + CGM.ErrorUnsupported(E, "reference binding"); return GetUndefRValue(DestType); } -- cgit v1.2.3