nested classes as template friends impossible?

Stefan Schwarzer sts@ica1.uni-stuttgart.de
Mon Mar 22 10:46:00 GMT 1999


// According to 14.5.3 (1) we should be able to declare friend a class template
//  or class template specialization and this code should compile quietly 
// Stefan Schwarzer ---  sts@ica1.uni-stuttgart.de

template <class T> 
struct A {
  template <class U> class B;

  // this is generous, but should work - compiles with edg frontends: cxx, KCC
  //  -- but does not compile with egcs-2.93.13 19990321 or 1.1.2  :-( 
  template <class S> template <class U> friend class A<S>::B; 
};

template <class S> template <class U> class A<S>::B {
}; 

int main(){
  A<double>::B<double>  ab;
  return 0; 
}




More information about the Gcc-bugs mailing list