While doing something tricky with templates I got an internal compiler error. jo@bogon:~/units$ g++-3.0 -ansi -Wall -c minimal.cc minimal.cc:15: warning: `class my_frobnicator' declares a new type at namespace scope; to refer to the inherited type, say `class foo::type' (names from dependent base classes are not visible to unqualified name lookup) minimal.cc:17: Internal compiler error in pop_binding, at cp/decl.c:1186 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions. A minimal test program that triggers the bug is included. Release: g++ 3.0.4, g++ 2.95.4 Environment: Debian testing distribution, self-compiled linux kernel version 2.4.18 How-To-Repeat: recompile the included test-program
Fix: no idea
From: Reichelt <reichelt@igpm.rwth-aachen.de> To: gcc-gnats@gcc.gnu.org, jototland@hotmail.com, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: c++/6289: partial template specialization and friend Date: Wed, 8 May 2002 00:42:23 +0200 Hi, the testcase can be reduced even further to the following code snippet which still crashes gcc 3.1 as of 20020506. ---------------------------snip here-------------------------- struct A { typedef int type; }; template <typename T> class B { typedef A::type X; friend class X; }; ---------------------------snip here-------------------------- Greetings, Volker Reichelt http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6289
From: Wolfgang Bangerth <bangerth@math.ethz.ch> To: reichelt@igpm.rwth-aachen.de, <gcc-gnats@gcc.gnu.org>, <jototland@hotmail.com>, <gcc-bugs@gcc.gnu.org> Cc: Subject: Re: c++/6289: partial template specialization and friend Date: Wed, 8 May 2002 10:36:26 +0200 (CEST) > the testcase can be reduced even further to the following code snippet > which still crashes gcc 3.1 as of 20020506. > > ---------------------------snip here-------------------------- > struct A > { > typedef int type; > }; > > template <typename T> > class B > { > typedef A::type X; > friend class X; > }; > ---------------------------snip here-------------------------- This is illegal, by the way, as a _real_ class is expected in a friend declaration, not a typedef. Someone may reclassify this bug as ice-on-illegal then. Regards Wolfgang ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@math.ethz.ch www: http://www.math.ethz.ch/~bangerth
From: Nathan Sidwell <nathan@acm.org> To: Reichelt <reichelt@igpm.rwth-aachen.de> Cc: gcc-gnats@gcc.gnu.org, jototland@hotmail.com, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, bangerth@math.ethz.ch Subject: Re: c++/6289: partial template specialization and friend Date: Wed, 08 May 2002 12:34:04 +0100 Reichelt wrote: > > Hi, > > here's an even shorter example: > > ---------------------------snip here-------------------------- > template <typename T> class B > { > typedef int X; > friend class X; > }; > ---------------------------snip here-------------------------- > > This is in fact legal code (and is accepted by SGI's and Comeau's > compiler for example). It would be illegal, if the friend declaration no it is ill formed. [7.1.5.3]/2 says if the identifier resolves to a typedef name, or a template type-parameter, the elaborated type specifier is ill-formed. nathan -- Dr Nathan Sidwell :: Computer Science Department :: Bristol University The voices in my head told me to say this nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk
From: Reichelt <reichelt@igpm.rwth-aachen.de> To: gcc-gnats@gcc.gnu.org, jototland@hotmail.com, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, bangerth@math.ethz.ch Cc: Subject: Re: c++/6289: partial template specialization and friend Date: Wed, 8 May 2002 12:52:10 +0200 Hi, here's an even shorter example: ---------------------------snip here-------------------------- template <typename T> class B { typedef int X; friend class X; }; ---------------------------snip here-------------------------- This is in fact legal code (and is accepted by SGI's and Comeau's compiler for example). It would be illegal, if the friend declaration read "friend class B<T>::X", but this way "friend class X" refers to a class outside of B (which hasn't been defined yet). If you add "class X;" before the definiton of B then the ICE vanishes. Greetings, Volker Reichelt http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6289
State-Changed-From-To: open->analyzed State-Changed-Why: As suggested in the follow up.
Btw, the bug is fixed on mainline. *** This bug has been marked as a duplicate of 7983 ***