This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12429] Template class Foo<X> cannot access private members of Foo<Y>


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();
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]