diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-02-01 19:32:59 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-02-01 19:32:59 +0000 |
commit | 70f233017bd3091137dcfbc00f6b2baea56edba9 (patch) | |
tree | b6183bc1d6b45d5525e3d5a01f670118415fc69f /lib/Sema | |
parent | be29d8d3dff34313c1ae1ae09145e64dd948b0da (diff) |
For "if ((a == b))" only warn if 'a' is a modifiable l-value. Caught by John!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124675 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 82771298e0..8448ed8079 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -9231,7 +9231,9 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *parenE) { Expr *E = parenE->IgnoreParens(); if (BinaryOperator *opE = dyn_cast<BinaryOperator>(E)) - if (opE->getOpcode() == BO_EQ) { + if (opE->getOpcode() == BO_EQ && + opE->getLHS()->IgnoreParenImpCasts()->isModifiableLvalue(Context) + == Expr::MLV_Valid) { SourceLocation Loc = opE->getOperatorLoc(); Diag(Loc, diag::warn_equality_with_extra_parens) << E->getSourceRange(); |