]> granicus.if.org Git - clang/commitdiff
Handle member expressions that return references correctly.
authorAnders Carlsson <andersca@mac.com>
Tue, 1 Sep 2009 21:18:52 +0000 (21:18 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 1 Sep 2009 21:18:52 +0000 (21:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80723 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
test/CodeGenCXX/references.cpp

index 43120156f8a6031cb348381df1896528d7bc57bb..5c8dfa46690cad9623a0b2b34c951011652191a6 100644 (file)
@@ -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:
index 8e1935675766331d1cf151e3db8913283fd442f1..6f4c1032efab5315151894e2594a607f0c89d244 100644 (file)
@@ -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();
+}