Title
Instantiation of type aliases from alias templates is unspecified
Status
ready
Section
13.9.2 [temp.inst]
Submitter
Hubert Tong

Created on 2025-10-23.00:00:00 last changed 1 month ago

Messages

Date: 2025-11-05.12:07:23

Proposed resolution (approved by CWG 2025-11-04):

Change in 13.7.8 [temp.alias] paragraph 2 as follows:

A
  • template-id that is not the operand of a reflect-expression or
  • splice-specialization-specifier
that designates the specialization of an alias template is equivalent to the associated type obtained by substitution of its template-arguments for the template-parameter s in the defining-type-id of the alias template. Any other template-id that names a specialization of an alias template is a typedef-name for a type alias; such a template-id is ill-formed if forming the associated type results in substitution failure. ...
Date: 2025-10-23.00:00:00

(From submission #782.)

P2996 added the idea that a type alias can result from instantiation of an alias template; however, the timing of the instantiation (and its relation to the immediate context) is unspecified.

Consider:

  #include <meta>

  using namespace std::meta;

  template <typename T> using A = T *;

  template <auto> struct Sink;

  template <typename T> void f(Sink<^^A<T> > * = 0); // immediately instantiated and considered as part of the immediate context?
  template <typename T> void f(int = 0);
  void g() { f<int &>(); }

  constexpr auto x = substitute(^^A, {^^int &}); // valid until dealias?
History
Date User Action Args
2025-11-06 23:04:52adminsetstatus: tentatively ready -> ready
2025-11-05 12:07:23adminsetstatus: open -> tentatively ready
2025-10-23 20:05:39adminsetmessages: + msg8169
2025-10-23 00:00:00admincreate