compiler error

Nathan Sidwell nathan@acm.org
Tue Nov 30 23:39:00 GMT 1999


Trevor Spiteri wrote:
> 
> The source file err.cc follows:
> 
> template <class T>
> class c {
> public:
>    int p;
>    void f()
>    {
>       c<int> r;
>       r.p = (typeof(r.p))3;
>    }
> };
GNU C version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
> err.cc: In method `void c<T>::f()':
> err.cc:8: Internal compiler error.
> err.cc:8: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
> err.cc:8: See <URL: http://egcs.cygnus.com/faq.html#bugreport > for details.
2.95 says,
nathan@manao:610>g++ -c -W -Wall spiteri.C 
spiteri.C: In method `void c<T>::f()':
spiteri.C:8: parse error before `3'

when one uses `__typeof__', it compiles without error.
The non-template equivalent gives a more informative diagnostic,
nathan@manao:612>g++ -c -W -Wall spiteri.C 
spiteri.C: In method `void c::f()':
spiteri.C:8: implicit declaration of function `int typeof(...)'
spiteri.C:8: parse error before `3'

nathan
-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
        I have seen the death of PhotoShop -- it is called GIMP
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk



More information about the Gcc-bugs mailing list