aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp6
1 files changed, 6 insertions, 0 deletions
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);
}