c++/6289: partial template specialization and friend

Reichelt reichelt@igpm.rwth-aachen.de
Wed May 8 03:20:00 GMT 2002


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




More information about the Gcc-bugs mailing list