This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15900] New: template friend member function declaration has no effect
- From: "thomas dot rudlof at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jun 2004 17:07:17 -0000
- Subject: [Bug c++/15900] New: template friend member function declaration has no effect
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
compiling:
------------------------------------------------------------------------
template<class T> struct A
{
void foo();
};
class B
{
template<class T> friend void A<T>::foo();
static int _b;
};
int B::_b = 0;
template<class T> void A<T>::foo() { ++B::_b; }
int main()
{
A<int> a;
a.foo();
}
-------------------------------------------------------------------
results in:
trudolf-l4:~/c> g++ -c friend.cc
friend.cc: In member function `void A<T>::foo() [with T = int]':
friend.cc:19: instantiated from here
friend.cc:12: `int B::_b' is private
friend.cc:14: within this context
trudolf-l4:~/c> g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
trudolf-l4:~/c>
--
Summary: template friend member function declaration has no
effect
Product: gcc
Version: 3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: thomas dot rudlof at gmx dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15900