зеркало из https://github.com/microsoft/clang.git
Don't do the checks of Sema::DiagnoseEqualityWithExtraParens() on type-dependent expressions. Fixes rdar://9027658.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128437 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
14086764e3
Коммит
170a6a229b
|
@ -9839,6 +9839,9 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *parenE) {
|
||||||
SourceLocation parenLoc = parenE->getLocStart();
|
SourceLocation parenLoc = parenE->getLocStart();
|
||||||
if (parenLoc.isInvalid() || parenLoc.isMacroID())
|
if (parenLoc.isInvalid() || parenLoc.isMacroID())
|
||||||
return;
|
return;
|
||||||
|
// Don't warn for dependent expressions.
|
||||||
|
if (parenE->isTypeDependent())
|
||||||
|
return;
|
||||||
|
|
||||||
Expr *E = parenE->IgnoreParens();
|
Expr *E = parenE->IgnoreParens();
|
||||||
|
|
||||||
|
|
|
@ -125,3 +125,16 @@ void test2() {
|
||||||
if ((test2 == fn)) {}
|
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}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче