Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are members of a nested class be members of the enclosing class? #4932

Open
xmh0511 opened this issue Sep 24, 2021 · 0 comments
Open

Are members of a nested class be members of the enclosing class? #4932

xmh0511 opened this issue Sep 24, 2021 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Sep 24, 2021

Consider the example that follows [temp.dep.type] p3

template<class T> struct A {
  typedef int M;
  struct B {
    typedef void M;
    struct C;
  };
};

template<class T> struct A<T>::B::C : A<T> {
  M m;                          // OK, A<T>​::​M
};

The example implies that A<T> is a current instantiation class in the definition of A<T>::B::C. However, according to [temp.dep.type#1.2]

A name or template-id refers to the current instantiation if it is

  • [...]
  • in the definition of a primary class template or a member of a primary class template, the name of the class template followed by the template argument list of its template-head ([temp.arg]) enclosed in <> (or an equivalent template alias specialization),
  • [...]

In this example, the primary class template is A, Is that saying the member class C of the nested class B is a member of class template A?

@xmh0511 xmh0511 changed the title Are members of a nested class be members of the enclsong class? Are members of a nested class be members of the enclosing class? Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant