Fix -Wunused-value to not warn on expressions that have unresolved lookups due
to dependent arguments. llvm-svn: 166468
This commit is contained in:
parent
58df27cb2e
commit
abf836cffa
|
@ -1950,6 +1950,11 @@ bool Expr::isUnusedResultAWarning(const Expr *&WarnE, SourceLocation &Loc,
|
|||
return false;
|
||||
}
|
||||
|
||||
// If we don't know precisely what we're looking at, let's not warn.
|
||||
case UnresolvedLookupExprClass:
|
||||
case CXXUnresolvedConstructExprClass:
|
||||
return false;
|
||||
|
||||
case CXXTemporaryObjectExprClass:
|
||||
case CXXConstructExprClass:
|
||||
return false;
|
||||
|
|
|
@ -46,3 +46,18 @@ namespace AnonObject {
|
|||
int(1); // expected-warning {{expression result unused}}
|
||||
}
|
||||
}
|
||||
|
||||
// Test that constructing an object (which may have side effects) with
|
||||
// constructor arguments which are dependent doesn't produce an unused value
|
||||
// warning.
|
||||
namespace UnresolvedLookup {
|
||||
struct Foo {
|
||||
Foo(int i, int j);
|
||||
};
|
||||
template <typename T>
|
||||
struct Bar {
|
||||
void f(T t) {
|
||||
Foo(t, 0); // no warning
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue