[RFC PATCH] avoid applying attributes to explicit specializations (PR 83871)

Michael Matz matz@suse.de
Tue Feb 13 15:59:00 GMT 2018


Hi,

On Mon, 12 Feb 2018, Martin Sebor wrote:

> >> Removing noreturn from the whitelist means having to prevent
> >> the attribute from causing conflicts with the attributes on
> >> the blacklist.  E.g., in this:
> >>
> >>   template <class T> [[malloc]] void* allocate (int);
> >>
> >>   template <> [[noreturn]] void* allocate<void> (int);

Marking a function having a return type as noreturn doesn't make sense.  
So a warning in this case is actually a good thing.  And changing the 
return type to void (so that noreturn makes sense) makes it not a 
specialization anymore (or alternatively if the primary is also changed to 
void then malloc doesn't make sense anymore).


Ciao,
Michael.



More information about the Gcc-patches mailing list