c++/8355: befriending a template in another namespace
paolo@gcc.gnu.org
paolo@gcc.gnu.org
Wed Nov 20 14:47:00 GMT 2002
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
More information about the Gcc-prs
mailing list