On Thu, Sep 12, 2019 at 11:08:43AM +0200, Paolo Carlini wrote:
> Hi again,
> 
> On 12/09/19 11:03, Paolo Carlini wrote:
> > Hi,
> > 
> > On 11/09/19 23:15, Marek Polacek wrote:
> > > --- gcc/cp/pt.c
> > > +++ gcc/cp/pt.c
> > > @@ -26709,7 +26709,7 @@ build_non_dependent_expr (tree expr)
> > >     if (TREE_CODE (expr) == COND_EXPR)
> > >       return build3 (COND_EXPR,
> > >              TREE_TYPE (expr),
> > > -           TREE_OPERAND (expr, 0),
> > > +           build_non_dependent_expr (TREE_OPERAND (expr, 0)),
> > >              (TREE_OPERAND (expr, 1)
> > >               ? build_non_dependent_expr (TREE_OPERAND (expr, 1))
> > >               : build_non_dependent_expr (TREE_OPERAND (expr, 0))),
> > 
> > Looks like we would end up unnecessarily calling
> > build_non_dependent_expr three times instead of two: probably is very
> > cheap, probably the code is cleaner this way but I'm a little annoyed at
> > this anyway, for the record ;)
> 
> Sorry, I misread the code: normally TREE_OPERAND (expr, 1) isn't NULL_TREE
> thus we are fine.

And I forgot to mention that build_x_conditional_expr has

 6743       ifexp = build_non_dependent_expr (ifexp);
 6744       if (op1)
 6745         op1 = build_non_dependent_expr (op1);
 6746       op2 = build_non_dependent_expr (op2);

which means my fix should make more sense. 

--
Marek Polacek • Red Hat, Inc. • 300 A St, Boston, MA

Reply via email to