CWG Issue 1558 (original) (raw)

This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-11-05


1558. Unused arguments in alias template specializations

Section: 13.7.8 [temp.alias]Status: CD4Submitter: Nikolay IvchenkovDate: 2012-09-19

[Moved to DR at the November, 2014 meeting.]

The treatment of unused arguments in an alias template specialization is not specified by the current wording of 13.7.8 [temp.alias]. For example:

#include

template <class T, class...> using first_of = T;

template first_of<void, typename T::type> f(int) { std::cout << "1\n"; }

template void f(...) { std::cout << "2\n"; }

struct X { typedef void type; };

int main() { f(0); f(0); }

Is the reference to first_of<void, T::type> withT being int equivalent to simply void, or is it a substitution failure?

(See also issues 1430,1520, and 1554.)

Notes from the October, 2012 meeting:

The consensus of CWG was to treat this case as substitution failure.

Proposed resolution (February, 2014):

Add the following as a new paragraph before 13.7.8 [temp.alias] paragraph 3:

When a template-id refers to the specialization of an alias template, it is equivalent...

However, if the template-id is dependent, subsequent template argument substitution still applies to the template-id. [Example:

template<typename...> using void_t = void; template void_t f(); f(); // error, int does not have a nested type foo

—_end example_]

The type-id in an alias template declaration shall not refer...