Created on 2010-08-03.00:00:00 last changed 173 months ago
Rationale (August, 2010):
The specification is as intended; compilers should handle cases like these.
The following appears to be well-formed, with templates foo() being distinct since any type T will produce an invalid type for the second parameter for at least one foo() when T is replaced within the non-deduced context:
template <typename T> bool *foo(T *, enum T::u_type * = 0) { return 0; } template <typename T> char *foo(T *, struct T::u_type * = 0) { return 0; } struct A { enum u_type { I }; }; int main(void) { foo((A*)0); }
In particular, while determining the signature for the function templates foo(), an elaborated-type-specifier qualifies as part of the decl-specifier-seq under 9.3.4.6 [dcl.fct] paragraph 5 in determining the type of a parameter in the parameter-type-list (absent additional wording). Also, the return type is included in the signature of a function template.
Implementations do not appear to support this case and the ability to do so brings little value since type traits such as is_enum and is_class cannot be defined using this and equivalent functionality can be achieved using the aforementioned type traits.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-08-23 00:00:00 | admin | set | messages: + msg2953 |
2010-08-03 00:00:00 | admin | create |