ICE by template friend declaration within namespace

Ewgenij Gawrilow gawrilow@math.TU-Berlin.DE
Fri Mar 17 07:17:00 GMT 2000


The gcc 2.95.2 fails to compile the following fragment of code:

#line 1 "prob11.cc"
namespace N {
   template <class T> class C {
      template <class T1> friend class C;
   private:
      int p;
   public:
      template <class T1>
      C& operator=(const C<T1>& c) { p=c.p; return *this; }
   };
};


prob11.cc:3: Internal compiler error.

Changing C to N::C in the line 3 prolongs the compiler's life only till the end
of the class definition:

prob11.cc:9: Internal compiler error.

The same class definition put in the global space compiles fine.

With best regards,
Ewgenij Gawrilow
Dept. of Mathematics, Technical University of Berlin


More information about the Gcc-bugs mailing list