template + friend => Internal compiler error 9.

Mark Mitchell mmitchell@usa.net
Mon Feb 16 11:15:00 GMT 1998


    Hi,

    Before I begin, congratulations on egcs, in general it is great.

    [jami@sprite56 ~]$ cat foo.cc
    class C {
		    template<class T> friend foo<T>(const T& t);
    };
    [jami@sprite56 ~]$ g++ -v
    Reading specs from /usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.90.23/specs
    gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
    [jami@sprite56 ~]$ g++ foo.cc
    foo.cc:2: Internal compiler error 9.
    foo.cc:2: Please submit a full bug report to `egcs-bugs@cygnus.com'.
    [jami@sprite56 ~]$ 

    I'm not even sure if this is legal syntax.

It's not.  And, the current egcs snapshot says:

  test7.C:2: invalid member template declaration

You should write:

  template <class T> friend foo(const T& t);

This doesn't work either, at the moment, but I will be submitting a
patch that enables template friend functions within hours...

    Niall

-- 
Mark Mitchell		mmitchell@usa.net
Stanford University	http://www.stanford.edu




More information about the Gcc-bugs mailing list