CWG Issue 1471 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-04-13
1471. Nested type of non-dependent base
Section: 13.8.3.2 [temp.dep.type]Status: CD3Submitter: Johannes SchaubDate: 2012-02-26
[Moved to DR at the April, 2013 meeting.]
Even though A::C is a nested type and member of the current instantiation, and thus dependent by the rules of 13.8.3.2 [temp.dep.type] paragraph 8, there does not seem to be a good reason for making it so:
struct B { struct C { }; };
template struct A : B { A::C c; };
Proposed resolution (October, 2012):
[Some existing uses of the term “member of the current instantiation” are consistent with the definition in 13.8.3.2 [temp.dep.type] paragraph 4; others are intended to refer to members of the “current instantiation,” as defined in paragraph 1. The following resolution changes the latter to use the phrase “member of a class that is the current instantiation.”]
- Change 13.8.3.2 [temp.dep.type] paragraph 4 as follows:
A name is a member of the current instantiation if it is
- An unqualified name that, when looked up, refers to at least one member of a class that is the current instantiation or a non-dependent base class thereof. [_Note:_This can only occur when looking up a name in a scope enclosed by the definition of a class template. —_end note_]
- A qualified-id in which the _nested-name-specifier_refers to the current instantiation and that, when looked up, refers to at least one member of a class that is the current instantiation or a non-dependent base class thereof. [Note: if no such member is found, and the current instantiation has any dependent base classes, then the qualified-id is a member of an unknown specialization; see below. —_end note_]
- An id-expression denoting the member in a class member access expression (7.6.1.5 [expr.ref]) for which the type of the object expression is the current instantiation, and the_id-expression_, when looked up (_N4868_.6.5.6 [basic.lookup.classref]), refers to at least one member of a class that is the current instantiation or a non-dependent base class thereof. [Note: if no such member is found, and the current instantiation has any dependent base classes, then the_id-expression_ is a member of an unknown specialization; see below. —_end note_]
[Example: ... —_end example_]
A name is a _dependent member of the current instantiation_if it is a member of the current instantiation which, when looked up, refers to at least one member of a class that is the current instantiation.
- Change 13.8.3.2 [temp.dep.type] paragraph 5 as follows:
A name is a member of an unknown specialization if it is
- A qualified-id in which the_nested-name-specifier_ names a dependent type that is not the current instantiation.
- A qualified-id in which the nested-name-specifier_refers to the current instantiation, the current instantiation has at least one dependent base class, and name lookup of the_qualified-id does not find any member of a class that is the current instantiation or a non-dependent base class thereof.
- An id-expression denoting the member in a class member access expression (7.6.1.5 [expr.ref]) in which either
- the type of the object expression is the current instantiation, the current instantiation has at least one dependent base class, and name lookup of the id-expression does not find a member of a class that is the current instantiation or a non-dependent base class thereof; or
- the type of the object expression is dependent and is not the current instantiation.
- Change 13.8.3.2 [temp.dep.type] paragraph 8 as follows:
A type is dependent if it is
- ...
- a nested class or enumeration that is a dependentmember of the current instantiation,
- ...
- Change 13.8.3.3 [temp.dep.expr] paragraph 3 as follows:
An id-expression is type-dependent if it contains
- ...
or if it names a
static datadependent member of the current instantiation thathasis a static data member of type “array of unknown bound ofT” for some T (13.7.2.5 [temp.static]). Expressions of the following forms...
- Change 13.8.3.4 [temp.dep.constexpr] paragraph 2 as follows (assumes the base text is as modified by issue 1413):
An id-expression is value-dependent if:
- it is a name declared with a dependent type,
- it is the name of a non-type template parameter,
- it names a member of an unknown specialization,
- it names a static data member
of the current instantiationthat is a dependent member of the current instantiation and is not initialized in a_member-declarator_,- it names a static member function that is adependent member of the current instantiation, or
- it is a constant with literal type and is initialized with an expression that is value-dependent.
Expressions of the following form...
- Change 13.8.3.4 [temp.dep.constexpr] paragraph 5 as follows (assumes the base text is as modified by issue 1413):
An expression of the form &qualified-id where the_qualified-id_
's nested-name-specifiernamesa dependent member of the current instantiation is value-dependent.