Created on 2011-12-09.00:00:00 last changed 146 months ago
Rationale (October, 2012):
This example is covered by the wording in 13.8.2 [temp.local] paragraphs 7-8: the template parameter is found.
Consider:
struct A { struct B { typedef int X; }; }; template<class B> struct C : A { B::X q; // Ok: A::B. struct U { typedef int X; }; template<class U> struct D; }; template<class B> template<class U> struct C<B>::D { typename U::X r; // which U? }; C<int>::D<double> y;
In the definition of D, U definitely needs to be in scope as soon as it's declared because it might have been used in subsequent template parameter declarations, or it might have been used in the id-expression that names the declared entity — just as B is used in C<B>::D. (So 6.4.9 [basic.scope.temp] does the right thing for that purpose.)
But it would be nice if the result of lookup did not depend on whether D's body appears lexically inside C's body; currently, we don't seem to have the wording that makes it so.
History | |||
---|---|---|---|
Date | User | Action | Args |
2012-11-03 00:00:00 | admin | set | messages: + msg4172 |
2012-11-03 00:00:00 | admin | set | status: open -> nad |
2011-12-09 00:00:00 | admin | create |