On Mon, Jun 02, 2014 at 06:36:06PM +0200, Jakub Jelinek wrote:
> 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.
 
Hmm, I see no crash; the types seem to be
template_type_parm 0x7ffff013d5e8 T type_0 type_6 VOID ...

> 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 ...

Ah - indeed.  So I suggest to stay with !processing_template_decl ;).

        Marek

Reply via email to