Problem with templates and friends on g++ 3.4.2

"Angel Tsankov" <[email protected]> Mon, 28 Mar 2005 19:52:20 +0300
Newsgroups gmane.comp.gnu.mingw.patches
Message-ID <001d01c533b6$81f1d060$cf34000a@sven>
I've just installed WinGW 3.2.0 RC 3 (g++ -v returns 3.4.2) and got an error 
compiling the following piece of c++ code:

template< typename t >
class t2
{
    friend t; // error: a class-key must be used when declaring a friend
};

Then I tried to compile this code:

template< typename t >
class t2
{
    friend typename t;          // this is main.cpp:6
};

and got this:

main.cpp:6: error: expected nested-name-specifier before "t"
main.cpp:6: error: ISO C++ forbids declaration of `t' with no type
main.cpp:6: error: `t' is neither function nor member function; cannot be 
declared friend

I think the second piece of code is perfectly legal and should compile (at 
least it was reported to compile on gcc 3.4.3).

Should I upgrade to 3.4.3 (and if so, how?) or is there any workaround for 
the issue? 




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click