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

The wordings of the paragraph [temp.dep.type#1] miss some examples #4199

Open
xmh0511 opened this issue Sep 16, 2020 · 2 comments
Open

The wordings of the paragraph [temp.dep.type#1] miss some examples #4199

xmh0511 opened this issue Sep 16, 2020 · 2 comments
Labels
cwg Issue must be reviewed by CWG.

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Sep 16, 2020

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
};

For this example, the base class A<T> refers to a current instantiation name, hence it's not a dependent base class, hence name lookup will find name M in A<T>. However, the rule defines what is a current instantiation name are as the following:

A name 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 the primary template (as described below) enclosed in <> (or an equivalent template alias specialization),

However, in the above example, we define the class C which is not the member of class template A. Firstly, these's no any rule in the standard describes such a member of a nested class is also considered as a member of a class of which the nested class is a member. Secondly, If we consider such a member (class C) is a member of the outmost enclosing class, then it would change the meaning of far too many other rules about members(discussed in this topic of std-discussion ). IIUC, the intent of [temp.dep.type#1] want to cover that any name of these enclosing classes(enclosing class templates) is the current instantiation name(include the template-id whose template-name is the name of these enclosing classes).

@xmh0511 xmh0511 changed the title The wording of paragraph [temp.dep.type#1] miss some examples The wordings of the paragraph [temp.dep.type#1] miss some examples Sep 16, 2020
@jensmaurer
Copy link
Member

This doesn't appear to be an editorial matter.

@jensmaurer jensmaurer added the cwg Issue must be reviewed by CWG. label Sep 20, 2020
@xmh0511
Copy link
Contributor Author

xmh0511 commented Sep 21, 2020

This doesn't appear to be an editorial matter.

Maybe a wording defect, I think that change the sentence "the name of the class template followed by the template argument list of the primary template (as described below) enclosed in <> (or an equivalent template alias specialization)" to "for a member, any name of the enclosing class templates (if any) followed by the template argument list of the corresponding primary template (as described below) enclosed in <> (or an equivalent template alias specialization)", or it would be a better wording to describe such a meaning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG.
Projects
None yet
Development

No branches or pull requests

2 participants