From 40412acc0282908a2e76ec419890513065884547 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 19 Nov 2008 17:17:41 +0000 Subject: Support overloading of the subscript operator[], including support for built-in operator candidates. Test overloading of '&' and ','. In C++, a comma expression is an lvalue if its right-hand subexpression is an lvalue. Update Expr::isLvalue accordingly. llvm-svn: 59643 --- clang/lib/AST/Expr.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/AST/Expr.cpp') diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index a179af8b145..061402076e5 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -412,6 +412,11 @@ Expr::isLvalueResult Expr::isLvalue(ASTContext &Ctx) const { case BinaryOperatorClass: case CompoundAssignOperatorClass: { const BinaryOperator *BinOp = cast(this); + + if (Ctx.getLangOptions().CPlusPlus && // C++ [expr.comma]p1 + BinOp->getOpcode() == BinaryOperator::Comma) + return BinOp->getRHS()->isLvalue(Ctx); + if (!BinOp->isAssignmentOp()) return LV_InvalidExpression; -- cgit v1.2.3