On Mon, May 18, 2020 at 03:50:55PM -0400, Jason Merrill via Gcc-patches wrote:
> On 5/16/20 6:32 PM, Marek Polacek wrote:
> > +  const int q1 = cp_type_quals (pointee1);
> > +  const int q2 = cp_type_quals (pointee2);
> > +  const int quals = q1 | q2;
> >     result_type = cp_build_qualified_type (result_type,
> > -                                    (cp_type_quals (pointee1)
> > -                                     | cp_type_quals (pointee2)));
> > +                                    (quals | (*add_const
> > +                                              ? TYPE_QUAL_CONST
> > +                                              : TYPE_UNQUALIFIED)));
> 
> Since you're splitting out some of the arithmetic into local variables, why
> not handle *add_const there as well?

I didn't do that because right after this line we have

  if (quals != q1 || quals != q2)

and I didn't want 'add_const' to interfere with 'quals'.  It actually couldn't
do anything bad, just set 'add_const' unnecessarily.  I guess I'll leave it
as-is, but I don't feel strongly about it.

> OK either way.

Thanks,

Marek

Reply via email to