• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
g++ compiler bug. (Bug ID# 3887023)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: g++ compiler bug. (Bug ID# 3887023)
      • From: Andrew Pinski <email@hidden>
  • Prev by Date: Re: Xcode ignores SYMROOT settings in targets on second machine
  • Next by Date: Re: Alert Noise on Parens, etc
  • Previous by thread: Re: Xcode ignores SYMROOT settings in targets on second machine
  • Next by thread: Re: g++ compiler bug. (Bug ID# 3887023)
  • Index(es):
    • Date
    • Thread