This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/6289: partial template specialization and friend
- From: Reichelt <reichelt at igpm dot rwth-aachen dot de>
- To: gcc-gnats at gcc dot gnu dot org, jototland at hotmail dot com, gcc-bugs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, bangerth at math dot ethz dot ch
- Date: Wed, 8 May 2002 12:52:10 +0200
- Subject: Re: c++/6289: partial template specialization and friend
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