[cfe-commits] r128437 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaCXX/warn-assignment-condition.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Mar 28 16:52:04 PDT 2011
Author: akirtzidis
Date: Mon Mar 28 18:52:04 2011
New Revision: 128437
URL: http://llvm.org/viewvc/llvm-project?rev=128437&view=rev
Log:
Don't do the checks of Sema::DiagnoseEqualityWithExtraParens() on type-dependent expressions. Fixes rdar://9027658.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/warn-assignment-condition.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=128437&r1=128436&r2=128437&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Mar 28 18:52:04 2011
@@ -9839,6 +9839,9 @@
SourceLocation parenLoc = parenE->getLocStart();
if (parenLoc.isInvalid() || parenLoc.isMacroID())
return;
+ // Don't warn for dependent expressions.
+ if (parenE->isTypeDependent())
+ return;
Expr *E = parenE->IgnoreParens();
Modified: cfe/trunk/test/SemaCXX/warn-assignment-condition.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-assignment-condition.cpp?rev=128437&r1=128436&r2=128437&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-assignment-condition.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-assignment-condition.cpp Mon Mar 28 18:52:04 2011
@@ -125,3 +125,16 @@
if ((test2 == fn)) {}
}
+namespace rdar9027658 {
+template <typename T>
+void f() {
+ if ((T::g == 3)) { } // expected-warning {{equality comparison with extraneous parentheses}} \
+ // expected-note {{use '=' to turn this equality comparison into an assignment}} \
+ // expected-note {{remove extraneous parentheses around the comparison to silence this warning}}
+}
+
+struct S { int g; };
+void test() {
+ f<S>(); // expected-note {{in instantiation}}
+}
+}
More information about the cfe-commits
mailing list