Title
Dependent unnamed types
Status
cd6
Section
13.8.3.2 [temp.dep.type]
Submitter
Hubert Tong

Created on 2014-01-08.00:00:00 last changed 27 months ago

Messages

Date: 2014-02-15.00:00:00

Notes from the February, 2014 meeting:

There are other cases in which a named entity is dependnet, even though it cannot be explicitly specialized. CWG felt that the most consistent rule would be to make all nested classes dependent, whether named or not.

Date: 2020-11-15.00:00:00

[Accepted at the November, 2020 meeting as part of paper P1787R6 and moved to DR at the February, 2021 meeting.]

The specification of dependent types in 13.8.3.2 [temp.dep.type] is given in terms of names. However, one might consider some unnamed types as dependent. Consider the following example:

  template <typename T> struct A {
    struct { } obj;
    void foo() {
      bar(obj); // lookup for bar when/where?
    }
  };

  void bar(...);

  int main() {
    A<int> a;
    a.foo();    // calls bar(...)?
  }

If the type of A::obj had a name, it would be dependent. However, the rationale for making nested types dependent is that they are subject to explicit specialization and thus not knowable at the point of the template definition. An unnamed type, as in this example, cannot be explicitly specialized and thus could be considered as a member of the current instantiation. Which treatment is intended?

History
Date User Action Args
2022-08-19 07:54:33adminsetstatus: drwp -> cd6
2021-02-24 00:00:00adminsetstatus: accepted -> drwp
2020-12-15 00:00:00adminsetstatus: open -> accepted
2014-03-03 00:00:00adminsetmessages: + msg4918
2014-01-08 00:00:00admincreate