This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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

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


> 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 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]