This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC bug when using typeof
On Mon, Oct 20, 2008 at 7:04 PM, Peng Yu <pengyu.ut@gmail.com> wrote:
> Hi,
>
> I tried to compile the following program, but I got the following
> error. Is it a bug of GCC? Has it been fixed in a newer version GCC?
>
It is a bug in GCC but in later versions 4.3.0 and above, we get a
sorry message:
t.cc: In instantiation of 'B::Y<__typeof__ ((T1() * T2()))>
B::operator*(const B::Y<T1>&, const T2&) [with T1 = A::X<int>, T2 =
int]':
t.cc:54: instantiated from here
t.cc:46: sorry, unimplemented: mangling typeof, use decltype instead
Replacing typeof with __decltype (or decltype in c++0x/g++0x modes)
works in 4.3.0 and above.
Thanks,
Andrew Pinski