Title
Local classes of templated functions should be part of the current instantiation
Status
tentatively ready
Section
13.8.3.2 [temp.dep.type]
Submitter
Richard Smith

Created on 2024-09-02.00:00:00 last changed 1 week ago

Messages

Date: 2024-11-09.00:21:39

Proposed resolution (approved by CWG 2024-11-08):

Change in 13.8.3.2 [temp.dep.type] paragraph 1 as follows:

A name or template-id refers to the current instantiation if it is
  • ...
  • in the definition of a nested class of a class template, the name of the nested class referenced as a member of the current instantiation, or
  • in the definition of a class template partial specialization or a member of a class template partial specialization, the name of the class template followed by a template argument list equivalent to that of the partial specialization (13.7.6 [temp.spec.partial]) enclosed in <> (or an equivalent template alias specialization)., or
  • in the definition of a templated function, the name of a local class (11.6 [class.local].
Date: 2024-11-09.00:21:39

Consider:

  template<class T>
  void f()
  {
    struct Y {
      using type = int;
    };
    Y::type y;  // error; missing typename
  }

Since lookup of Y always finds the local class, regardless of T, the requirement to apply typename is too strict.

History
Date User Action Args
2024-11-09 00:21:39adminsetmessages: + msg7888
2024-11-09 00:21:39adminsetstatus: open -> tentatively ready
2024-09-02 00:00:00admincreate