This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8355: befriending a template in another namespace
- From: paolo at gcc dot gnu dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, pcarlini at unitus dot it, zach at cs dot uni-bonn dot de
- Date: 14 Nov 2002 12:38:41 -0000
- Subject: Re: c++/8355: befriending a template in another namespace
- Reply-to: paolo at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, pcarlini at unitus dot it, zach at cs dot uni-bonn dot de, gcc-gnats at gcc dot gnu dot org
Synopsis: befriending a template in another namespace
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Thu Nov 14 04:38:33 2002
State-Changed-Why:
Confirmed 3.2.1 pre and 3.3 exp. This is an useful link
http://www.cuj.com/experts/2101/sutter.htm
and these two summarizing test cases which do not
compile and should:
// Example 1 again
//
namespace boost {
template<typename T> void checked_delete( T* x ) {
// ... other stuff ...
delete x;
}
}
class Test {
~Test() { }
friend void boost::checked_delete( Test* x ); // the original code
};
int main() {
boost::checked_delete( new Test );
}
///////////////////////////////
// Example 2: The other way to declare friendship
//
namespace boost {
template<typename T> void checked_delete( T* x ) {
// ... other stuff ...
delete x;
}
}
class Test {
~Test() { }
friend void boost::checked_delete<>( Test* x );
};
int main() {
boost::checked_delete( new Test );
}
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8355