On Mon, Feb 28, 2022 at 04:30:01PM +0000, Iain Sandoe wrote:
> 
> 
> > On 28 Feb 2022, at 16:13, Jason Merrill <ja...@redhat.com> wrote:
> > 
> > On 2/25/22 17:59, Marek Polacek wrote:
> >> [ Most likely a GCC 13 patch, but I'm posting it now so that I don't lose 
> >> it. ]
> >> When looking into the other PR I noticed that we fail to give a warning
> >> for a deprecated enumerator when the enum is in a class template.  This
> >> only happens when the attribute doesn't have an argument.  The reason is
> >> that when we tsubst_enum, we create a new enumerator:
> >>       build_enumerator (DECL_NAME (decl), value, newtag,
> >>            DECL_ATTRIBUTES (decl), DECL_SOURCE_LOCATION (decl));
> >> but DECL_ATTRIBUTES (decl) is null when the attribute was provided
> >> without an argument -- in that case it simply melts into a tree flag.
> >> handle_deprecated_attribute has:
> >>       if (!args)
> >>          *no_add_attrs = true;
> >> so the attribute isn't retained and we lose it when tsubsting.  Same
> >> thing when the attribute is on the enum itself.
> >> Attribute unavailable is a similar case, but it's different in that
> >> it can be a late attribute whereas "deprecated" can't:
> > 
> > Iain, was this difference intentional?
> 
> The intent was to treat the two attributes the same way - so any difference
> is unintentional.

Thanks.  I'll send a patch soon.

Marek

Reply via email to