PING: [PATCH: c++/diagnostic/18313] Warn for pointless qualifiers on return type
Mark Mitchell
mark@codesourcery.com
Sun Nov 12 22:04:00 GMT 2006
Dirk Mueller wrote:
>> ? 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.
In general, what we do is warn at template-declaration time only if we
are sure the warning will make sense for all instantiations, and,
otherwise, warn at template-instantiation time if the warning makes
sense for that specific instantiation. Here, I think we should warn at
instantiation-time, since, in the presence of dependent types, we don't
what's a class, or what the cv-qualification may be.
However, as I understand it, your code won't warn about even:
template <typename T>
void f() {
extern const int g();
}
because we're in an template when we declare "g". If that's correct, I
think we need a different approach, so that we do warn at substitution-time.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
More information about the Gcc-patches
mailing list