This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12429] Template class Foo<X> cannot access private members of Foo<Y>
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Sep 2003 05:49:46 -0000
- Subject: [Bug c++/12429] Template class Foo<X> cannot access private members of Foo<Y>
- References: <20030927014658.12429.sean.gies@discreet.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12429
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-09-27 05:49 -------
Here is how to fix you code (yes I was right about "different specialization are really
different classes", the problem was that you were trying make friends with specializations
which is wrong):
template <class T> class Foo {
template <class Y> friend class Foo;
void Bar(int x=0) {if (x<4) Foo<int>().Bar(x+1);}
public:
void Test() {Bar();}
};
int main(int argc, char** argv) {
Foo<float>().Test();
}