Created on2011-05-05.00:00:00 last changed109 months ago
[Moved to DR at the May, 2015 meeting.]
Proposed resolution (November, 2014):
Change 13.8.3.2 [temp.dep.type] paragraph 7 as follows:
...If the result of this lookup differs from the resultof name lookup in the template definition context, namelookup is ambiguous.
[Note: the result of namelookup differs only when the member of the currentinstantiation was found in a non-dependent base class of thecurrent instantiation and a member with the same name isalso introduced by the substitution for a dependent baseclass of the current instantiation. —endnote][Example:struct A { int m; }; struct B { int m; }; template<typename T> struct C : A, T { int f() { return this->m; } // findsA::m in the template definition context }; template int C<B>::f(); // error: finds bothA::m andB::m—end example]
Notes from the December, 2011 teleconference:
Changes to the exposition were suggested and the issue returned to"drafting" status.
Proposed resolution (August, 2011) [SUPERSEDED]:
Change 13.8.3.2 [temp.dep.type] paragraph 7 as follows:
...If the result of this lookup differs from the result of namelookup in the template definition context, name lookup isambiguous.
[Note: the result of name lookup differs onlywhen the member of the current instantiation was found in anon-dependent base class of the current instantiation and a memberwith the same name is also introduced by the substitution for adependent base class of the current instantiation. —endnote][Example:struct A { int m; }; struct B { int m; }; template<typename T> struct C : A, T { int f() { return this->m; } // findsA::m in the template definition context }; int g(C<B> cb) { return cb.f(); // error: finds bothA::m andB::m in the template instantiation context }—end example]
The note in 13.8.3.2 [temp.dep.type] paragraph 7 reads,
[Note: the result of name lookup differs only when the memberof the current instantiation was found in a non-dependent base classof the current instantiation and a member with the same name is alsointroduced by the substitution for a dependent base class of thecurrent instantiation. —end note]
However, this is not correct. Consider the following example:
struct Y { int X; }; template<typename T> struct A : Y { enum B : int; void f() { A::X; } // findsY::X here! }; template<typename T> enum A<T>::B : int { X // introduces memberA::X intoA<T>! }; void g() { A<int> a; a.f(); }A::X is a member of the current instantiation, soparagraph 7 requires it to be looked up again when instantiating andto give a diagnostic if the lookup differs from the lookup in thedefinition context. The note incorrectly indicates that this can onlyhappen if the conflicting name was introduced by a dependent baseclass.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2017-02-06 00:00:00 | admin | set | status: drwp -> cd4 |
| 2015-11-10 00:00:00 | admin | set | status: dr -> drwp |
| 2015-05-25 00:00:00 | admin | set | messages: +msg6059 |
| 2015-05-25 00:00:00 | admin | set | status: ready -> dr |
| 2014-11-24 00:00:00 | admin | set | messages: +msg5155 |
| 2014-11-24 00:00:00 | admin | set | status: drafting -> ready |
| 2012-09-24 00:00:00 | admin | set | messages: +msg3900 |
| 2012-09-24 00:00:00 | admin | set | messages: +msg3899 |
| 2012-01-17 00:00:00 | admin | set | status: review -> drafting |
| 2011-05-05 00:00:00 | admin | create | |