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]

internal (c++) compiler error for unbound friend class template in a namespace


Hello,

I've found a bug in gcc 2.95.2 that is not present in egcs-2.91.66.
Here's some information about it. Feel free to e-mail me questions, if
you have any.

Bug summary:
gcc 2.95.2 reports an internal compiler error if:
 - A class template declares itself as an unbound friend class template
 - The declaration is in a namespace

The problem goes away if the unbound friend template class is not the
class itself, or if the sorrounding namespace declaration is removed,
such that the declaration appears in the global namespace.


I've tried it on two separate installations, and the results are
summarized below.

Common for both test cases:

Command:
  g++ -Wall -g -c tst.cpp


Compiler output ( g++ -Wall -g -c tst.cpp ):
  tst.cpp:6: Internal compiler error.
  tst.cpp:6: Please submit a full bug report.
  tst.cpp:6: See
<URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for
instructions.


Source example:
  namespace nsn {

    template< class Type >
    class Test {
      template< class T2 >
      friend class Test ;
    };

  } // namespace 


Test setups (Mandrake linux/gcc 2.95.2  and IRIX 6.5/gcc 2.95.2):


Mandrake linux:
  gcc --version
  2.95.2

  uname -a
  Linux linux1.compile.sourceforge.net 2.2.14-mosix #6 SMP Mon Feb 7
04:11:24 PST 2000 i686 unknown

IRIX:
  gcc --version
  2.95.2

  uname -a
  IRIX64 alzheimer 6.5 07151432 IP27




Incidently,

class Test {
  template< class T2 >
  friend class Test ;
};

seems to generate an internal compiler error, regardless of whether it
is declared in a namespace or not. I know it's bogus-code, but it still
shouldn't cause an internal compiler error, right :-)

Secondary bug report:
Reporting bugs to gcc is hard. If you go to the web site it sends you
off to the info pages for your local installation. For a brand new
redhat 6.2 the info pages says to report to egcs-bugs@egcs.cygnus.com.
This mailing list does not appear to exist anymore. How clever is it,
that the online resource sends you off to a possible outdated e-mail
address? :-)


best regards,

Thomas

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