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]
Other format: [Raw text]

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



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