[Bug c++/7818] protected members still non-reachable from an unbound friend template member function
lerdsuwa at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Aug 10 14:37:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7818
------- Additional Comments From lerdsuwa at gcc dot gnu dot org 2003-08-10 14:37 -------
I think the testcase is invalid, and the correct one should be:
template <class T> struct Y {
void member() {
X<int> c;
c.prot_data = 2;
}
};
template <class S> class X {
int prot_data;
template <class T> friend void Y<T>::member();
};
template class Y<int>;
Here Y<T>::member is declared before it is referenced
in the friend declaration. This is according to 8.3p1
section of the standard:
... When the declarator-id is qualified, the declaration
shall refer to a previously declared member of the class
or namespace to which the qualifier refers, ...
I'm working on a fix for the valid case above.
More information about the Gcc-bugs
mailing list