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: "sean dot gies at discreet dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Sep 2003 19:45:28 -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
------- Additional Comments From sean dot gies at discreet dot com 2003-09-29 19:45 -------
Subject: Re: Template class Foo<X> cannot access private members of Foo<Y>
Thank you for the fix. Just when I thought I finally understood
templates. :)
-Sean
On Friday, September 26, 2003, at 10:49 PM, pinskia at gcc dot gnu dot
org wrote:
> 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();
> }
>
>
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.