On Mon, Jun 02, 2014 at 12:31:32PM -0400, Jason Merrill wrote: > On 06/02/2014 12:23 PM, Marek Polacek wrote: > >I have no special reason for that check, so dropped it too in this > >patch. > > Thanks. I expect that warn_logical_not_parentheses will crash if one > of the operands is type-dependent such that TREE_TYPE is NULL_TREE, > so you'll want to handle that case, and test it in the testcase, > i.e. something like > > #ifdef __cplusplus > template <class T, class U> bool f(T t, U u) { return (!t == u); } > #endif > > I think !t should have null TREE_TYPE in this case.
Do we actually want to warn in that case? As the patch doesn't warn if the type is bool or vector, if somebody instantiates the above with say T=bool, U=bool, then we'd warn on something that otherwise will not be warned about when not in template. But to warn about this during instantiation, we'd need to somehow tell tsubst* whether it was !t == u or (!t) == u ... Jakub