g++ compiler bug. (Bug ID# 3887023)
g++ compiler bug. (Bug ID# 3887023)
- Subject: g++ compiler bug. (Bug ID# 3887023)
- From: Yarden Livnat <email@hidden>
- Date: Thu, 18 Nov 2004 21:44:51 -0700
Greetings,
I run into the following compilation error that seems to be a g++ bug
as it compile fine on SGI using MIPSpro 7.3 and on Windows using VC++
7.
consider the following:
------------------------------
class Test
{
public:
template<class T> T*fun() { return 0; }
};
void ok( Test t) { t.fun<int>(); }
template<typename X> void bad( Test &t) { t.fun<int>(); } // note that
it doesn't matter in we use <int> or <X>
-------------------------------
$ c++ -c t.cc
t.cc: In function `void bad(Test&)':
t.cc:12: error: parse error before `>' token
---------------------------------------
yes, there is a work around but it is ugly:
template<class T> T* Test::fun( T *) { return 0; }
template<typename X> void was_bad_now_ok(Test &t) { t.fun( (X *)0 ); }
// it gets ugly when 'fun' takes several arguments
---------------------------------------
So,
Any ideas why g++ refused (gcc 3.3/10.3.6 as well as gcc 3.2 on Red
Hat) to compile this code ?
Any betters ideas how to workaround it ?
thanks,
Yarden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden