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]

Re: c++/8355: befriending a template in another namespace


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


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