PING: [PATCH: c++/diagnostic/18313] Warn for pointless qualifiers on return type

Dirk Mueller dmuell@gmx.net
Sun Nov 12 21:25:00 GMT 2006


On Sunday, 12. November 2006 20:17, Mark Mitchell wrote:

> Minor nit-pick: I tend to check !processing_template_decl first 

changed. 

> Also, what does this do with:
>
>   typedef const int I;
>   I f();

it warns. I'll add it to the testcase. 

> ?  Also, what does this do with templates:
>   template <typename T>
>   void f() {
>     T (*p)();
>   }
>
>   f<const int>()
>
> ?

It doesn't warn about anything template related.

> The declarators won't be re-processed in the template case, so your
> patch won't work there, IIUC.  I think we need an approach that works in
> that situation.

I'm not sure. I think template code is all about re-usability, so the template 
code might and might not be instantiated with class types (or even pointer 
types), and therefore qualifiers might or might not make sense. Therefore I 
believe it is unfair to warn about those qualifiers at template declaration 
time. And even at template instantiation time it might be wrong to warn about 
it, given that the template code can perfectly be re-used in different 
context. Especially for this warning, which is just a nitpicker warning, I 
rather don't want to over-do it, just polishing to be en par with the C 
frontend. 


Dirk



More information about the Gcc-patches mailing list