[Bug c++/12429] Template class Foo<X> cannot access private members of Foo<Y>
sean dot gies at discreet dot com
gcc-bugzilla@gcc.gnu.org
Mon Sep 29 20: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=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.
More information about the Gcc-bugs
mailing list