This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


1162. Dependent elaborated-type-specifiers in non-deduced contexts

Section: 13.8  [temp.res]     Status: NAD     Submitter: CA     Date: 2010-08-03

N3092 comment CA 6

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 [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.

Rationale (August, 2010):

The specification is as intended; compilers should handle cases like these.