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]

Bug report


The following program:
#include <iostream.h>

template <class TYPE> class T;

class A {
   template <class TYPE> friend class T;
   int pvar;
   };

template <class TYPE> class T {
public:
   void func() {
      A a;
      cout<<__PRETTY_FUNCTION__<<endl;
      a.pvar = 0;
      }
   };

void main() {
   T<char> t;
   t.func();
   }

Doesn't compile with:
Reading specs from /opt/gnu/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1/specs
gcc version 2.8.1

And reports the following:
friends.cc:6: invalid member template declaration
friends.cc: In method `void T<char>::func()':
friends.cc:15: member `pvar' is a private member of class `A'

But with egcs version:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

it compiles very well and produces the following output:
void T<char>::func<char>()
 

PAB


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