Ignore void returning overloaded functions fom -Wunused-comparison. PR19791.
llvm-svn: 209186
This commit is contained in:
parent
d52b1528c0
commit
ccedd52736
|
@ -2094,7 +2094,8 @@ bool Expr::isUnusedResultAWarning(const Expr *&WarnE, SourceLocation &Loc,
|
||||||
case OO_Greater:
|
case OO_Greater:
|
||||||
case OO_GreaterEqual:
|
case OO_GreaterEqual:
|
||||||
case OO_LessEqual:
|
case OO_LessEqual:
|
||||||
if (Op->getCallReturnType()->isReferenceType())
|
if (Op->getCallReturnType()->isReferenceType() ||
|
||||||
|
Op->getCallReturnType()->isVoidType())
|
||||||
break;
|
break;
|
||||||
WarnE = this;
|
WarnE = this;
|
||||||
Loc = Op->getOperatorLoc();
|
Loc = Op->getOperatorLoc();
|
||||||
|
|
|
@ -119,3 +119,17 @@ void test() {
|
||||||
cout < cin; // expected-warning {{relational comparison result unused}}
|
cout < cin; // expected-warning {{relational comparison result unused}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace PR19791 {
|
||||||
|
struct S {
|
||||||
|
void operator!=(int);
|
||||||
|
int operator==(int);
|
||||||
|
};
|
||||||
|
|
||||||
|
void test() {
|
||||||
|
S s;
|
||||||
|
s != 1;
|
||||||
|
s == 1; // expected-warning{{equality comparison result unused}}
|
||||||
|
// expected-note@-1{{use '=' to turn this equality comparison into an assignment}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue