summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-20 00:36:58 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-20 00:36:58 +0000
commit7d4c083c1909ba1da94754abfab157efcbe7e898 (patch)
tree12e227ef70bb5fdd86df6ab61e68d2782a914fe9 /clang/lib/CodeGen/CGExpr.cpp
parent7248923a5da4244e426b74205402df78b607ea54 (diff)
Bind references to lvalues correctly.
llvm-svn: 72150
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index dc447983f0e4..bb9f20003ac1 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/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);
}