Original-Message-ID: <39316AE0.23BA3EF4@miba.auc.dk> Date: Sun, 28 May 2000 20:52:16 +0200 [the first issues is fixed in 2.96, the second one remains - MvL] 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 :-) Release: 2.95.2 Unformatted: namespace
State-Changed-From-To: analyzed->closed State-Changed-Why: Your first example compiles without diagnostics. Your second produces (with CVS G++) bash-2.04$ g++ /tmp/test.C /tmp/test.C:3: `class Test' is not a template bash-2.04$
From: neil@gcc.gnu.org To: gcc-gnats@gcc.gnu.org, martin@loewis.home.cs.tu-berlin.de, nobody@gcc.gnu.org, thomas@miba.auc.dk Cc: Subject: Re: c++/260 Date: 14 Jan 2001 21:42:30 -0000 Synopsis: internal (c++) compiler error for unbound friend class template in a State-Changed-From-To: analyzed->closed State-Changed-By: neil State-Changed-When: Sun Jan 14 13:42:30 2001 State-Changed-Why: Your first example compiles without diagnostics. Your second produces (with CVS G++) bash-2.04$ g++ /tmp/test.C /tmp/test.C:3: `class Test' is not a template bash-2.04$ http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=260&database=gcc