Created on 2005-01-25.00:00:00 last changed 239 months ago
Rationale (April, 2005):
The Standard is clear and consistent; this rule is the result of an explicit decision by the Committee.
I just received a query from a user of why line #1 in the following snippet is ill-formed:
void g(int (*)(int)); template<class T> class A { friend int f(int) { return 0; } void h() { g(f); // #1 } };
I believe that the special invisibility rule about friends is too complicated and makes life too complicated, especially considering that friends in templates are not templates, nor can they be conveniently rewritten with a “first declare at the namespace scope” rule. I can understand the rules when they make programming easier or prevent some obvious “silly” mistakes; but that does not seem to be the case here.
John Spicer: See two papers that discuss this issue: N0878 by Bill Gibbons, which ultimately gave rise to our current rules, and N0913 by me as an alternative to N0878.
History | |||
---|---|---|---|
Date | User | Action | Args |
2005-05-01 00:00:00 | admin | set | messages: + msg1199 |
2005-05-01 00:00:00 | admin | set | status: open -> nad |
2005-01-25 00:00:00 | admin | create |