summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-19 17:17:41 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-19 17:17:41 +0000
commit40412acc0282908a2e76ec419890513065884547 (patch)
treefefa44134d9058f9ab8d52b6553bca88ff2f9411 /clang/lib/AST/Expr.cpp
parent0f09564ffc47f55379498ef1ea9b23bbc2eb5027 (diff)
downloadbcm5719-llvm-40412acc0282908a2e76ec419890513065884547.tar.gz
bcm5719-llvm-40412acc0282908a2e76ec419890513065884547.zip
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
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp5
1 files changed, 5 insertions, 0 deletions
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<BinaryOperator>(this);
+
+ if (Ctx.getLangOptions().CPlusPlus && // C++ [expr.comma]p1
+ BinOp->getOpcode() == BinaryOperator::Comma)
+ return BinOp->getRHS()->isLvalue(Ctx);
+
if (!BinOp->isAssignmentOp())
return LV_InvalidExpression;
OpenPOWER on IntegriCloud