Title
Unused arguments in alias template specializations
Status
cd4
Section
13.7.8 [temp.alias]
Submitter
Nikolay Ivchenkov

Created on 2012-09-19.00:00:00 last changed 87 months ago

Messages

Date: 2014-11-15.00:00:00

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

Date: 2014-02-15.00:00:00

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<typename T> void_t<typename T::foo> f();
  f<int>(); // error, int does not have a nested type foo

end example]

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

Date: 2012-10-15.00:00:00

Notes from the October, 2012 meeting:

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

Date: 2012-11-03.00:00:00

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 <iostream>

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

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

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

  struct X { typedef void type; };

  int main() {
    f<X>(0);
    f<int>(0);
  }

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

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

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5411
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-03-03 00:00:00adminsetmessages: + msg4849
2014-03-03 00:00:00adminsetstatus: drafting -> ready
2012-11-03 00:00:00adminsetmessages: + msg4107
2012-11-03 00:00:00adminsetstatus: open -> drafting
2012-09-19 00:00:00admincreate