[PATCH] Add gnu::diagnose_as attribute

Matthias Kretz m.kretz@gsi.de
Tue Jun 22 07:30:45 GMT 2021

On Wednesday, 16 June 2021 02:48:09 CEST Jason Merrill wrote:
> > IIUC, your main concern is that my proposed diagnose_as *can* be used to
> > make diagnostics worse, by replacing names with strings that are not
> > valid identifiers. Of course, whoever uses the attribute to that effect
> > should have a good reason to do so. Is your other concern that using the
> > attribute in a "good" way is repetitive? Would you be happier if I make
> > the string argument to the attribute optional for type aliases?
> Yes, and namespace aliases.

I'll look into making the attribute argument optional for aliases. Would you 
accept the patch with this change?


1. If a type alias applies the attribute after a type was completed / 
implicitly instantiated (and possibly already used in diagnostics) should / 
can I still modify the type and add the attribute?

2. About the namespace aliases: IIUC an attribute would currently be rejected 
because of the C++ grammar. Do you want to make it valid before WG21 
officially decides how to proceed? And if you have a pointer for me where I'd 
have to adjust the grammar rules, that'd help. :)


 Dr. Matthias Kretz                           https://mattkretz.github.io
 GSI Helmholtz Centre for Heavy Ion Research               https://gsi.de
 std::experimental::simd              https://github.com/VcDevel/std-simd

More information about the Gcc-patches mailing list