You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
template<classT> structA {
typedefint M;
structB {
typedefvoid M;
structC;
};
};
template<classT> structA<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).
The text was updated successfully, but these errors were encountered:
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
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.
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 nameM
inA<T>
. However, the rule defines what is a current instantiation name are as the following:However, in the above example, we define the class
C
which is not the member of class templateA
. 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).The text was updated successfully, but these errors were encountered: