[cxx-abi-dev] Decltype mangling and type dependency
John McCall
rjmccall at apple.com
Wed Feb 23 02:00:33 UTC 2011
On Feb 22, 2011, at 5:44 PM, John Spicer wrote:
> On Feb 22, 2011, at 8:28 PM, Jason Merrill wrote:
>> It occurs to me now that this is really a language question, not ABI. Is this testcase well-formed?
>>
>> template<class T, T* u>
>> struct S
>> {
>> decltype(u) foo(T);
>> };
>>
>> template<class T, T *u>
>> T* S<T, u>::foo(T)
>> {
>> T t;
>> return t;
>> }
>>
>> Type matching rules aren't well specified in the WP, but it seems reasonable to say that the definition needs to use decltype as well, which matches the decision to mangle decltype(u) in the signature.
>>
>>
>
> Agreed.
>
> I don't see any benefit in supporting inconsistent programming practices such as this.
Right. I think it's just an oversight that [temp.over.link] doesn't apply to member functions of class templates. If we do apply that, then this is ill-formed because the tokens aren't alpha-equivalent.
As an aside, I was looking through N3126 for explicit language saying that template member functions are not formally considered to be function templates, and found an unfortunately-worded footnote in [temp.mem.func]p1 which suggests the opposite. Most of the standard would explode if this were true, I think; certainly e.g. [temp.func.order] is not supposed to apply. That would be good to clarify and fix.
John.
More information about the cxx-abi-dev
mailing list