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++/12286] New: friend declaration in a template class using a specialized template for the friend isn't recognised.


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12286

           Summary: friend declaration in a template class using a
                    specialized template for the friend isn't recognised.
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: conway at mds dot rmit dot edu dot au
                CC: gcc-bugs at gcc dot gnu dot org

See transcript following: 
 
conwaypc::~> cat x.cc 
 
class Foo 
{ 
public: 
}; 
 
template <class T> class Vector; 
 
template <class T> 
class UseRef 
{ 
public: 
private: 
    //friend class Vector<UseRef<T> >; 
    friend class Vector<UseRef<Foo> >; 
 
    void bar() {} 
}; 
 
template <class T> 
class Vector 
{ 
public: 
    void foo() 
    { 
        u.bar(); 
    } 
 
    T u; 
 
    Vector() 
    { 
        foo(); 
    } 
}; 
 
Vector<UseRef<Foo> > x; 
conwaypc::~> gcc -c x.cc 
x.cc: In member function `void Vector<T>::foo() [with T = UseRef<Foo>]': 
x.cc:33:   instantiated from `Vector<T>::Vector() [with T = UseRef<Foo>]' 
x.cc:37:   instantiated from here 
x.cc:17: `void UseRef<T>::bar() [with T = Foo]' is private 
x.cc:26: within this context 
conwaypc::~> gcc --version 
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5) 
Copyright (C) 2002 Free Software Foundation, Inc. 
This is free software; see the source for copying conditions.  There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE. 
 
conwaypc::~> uname -a 
Linux conwaypc 2.4.20-18.1.caps #1 Wed Jun 4 17:41:45 PDT 2003 i686 i686 i386 
GNU/Linux


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