J
Johannes Schaub (litb)
The following is not currently well-formed:
template<typename>
struct base { void f() { } };
struct A : base<int> {
void f(int) { }
};
int main() {
A a;
a.base::f();
}
It would seem to be beneficial to make this work by finding the inherited
injected class name of base<int> in A. But currently it is ill-formed
because that name does not denote the same entity as the name found in the
context of the entire postfix-expression, which refers to the base template.
To make this work, could one not get rid of the part of 3.4.3/1 that says
"... and templates whose specializations are types."? When is a class-
template name or a template alias name ever going to be valid before a "::"?
So if this part would be removed, the global base template would be ignored,
and only the injected class name in A would be found and the program would
be valid.
template<typename>
struct base { void f() { } };
struct A : base<int> {
void f(int) { }
};
int main() {
A a;
a.base::f();
}
It would seem to be beneficial to make this work by finding the inherited
injected class name of base<int> in A. But currently it is ill-formed
because that name does not denote the same entity as the name found in the
context of the entire postfix-expression, which refers to the base template.
To make this work, could one not get rid of the part of 3.4.3/1 that says
"... and templates whose specializations are types."? When is a class-
template name or a template alias name ever going to be valid before a "::"?
So if this part would be removed, the global base template would be ignored,
and only the injected class name in A would be found and the program would
be valid.