aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-01 21:18:52 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-01 21:18:52 +0000
commitfaf86648bfab7e0fa975e2b32c10fe1d8b461e8c (patch)
treed4cae449475129f052e05d098e8f940b7633c026
parentde738fe899b5c1d387dbc66a1122032e694d3d6f (diff)
Handle member expressions that return references correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80723 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGExpr.cpp1
-rw-r--r--test/CodeGenCXX/references.cpp8
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 43120156f8..5c8dfa4669 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -195,6 +195,7 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
case Expr::BinaryOperatorClass:
return EmitBinaryOperatorLValue(cast<BinaryOperator>(E));
case Expr::CallExprClass:
+ case Expr::CXXMemberCallExprClass:
case Expr::CXXOperatorCallExprClass:
return EmitCallExprLValue(cast<CallExpr>(E));
case Expr::VAArgExprClass:
diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp
index 8e19356757..6f4c1032ef 100644
--- a/test/CodeGenCXX/references.cpp
+++ b/test/CodeGenCXX/references.cpp
@@ -87,3 +87,11 @@ int reference_decl() {
const int& b = 1;
return a+b;
}
+
+struct A {
+ int& b();
+};
+
+void f(A* a) {
+ int b = a->b();
+}