[c++] Another question about demangler output
Ian Lance Taylor
ian@wasabisystems.com
Sun Dec 7 02:55:00 GMT 2003
Daniel Jacobowitz <drow@mvista.com> writes:
> Consider this program:
> template<typename B> class BB { public: BB() { }
> typedef int (*foot)(void);
> operator foot () { return 0; }
> };
>
> BB<int> obj;
>
> int foo()
> {
> return ((int (*)(void)) obj) != 0;
> }
>
> One symbol generated by this program is _ZN2BBIiEcvPFivEEv, which demangles
> as:
> BB<int>::operator int (*)()()
You don't need the template, of course. You can get your irritating
result with simply
class BB { typedef int (*foot)(void); operator foot (); };
BB::operator foot() { return 0; }
This gives _ZN2BBcvPFivEEv which (currently) demangles as
BB::operator int (*)()()
But using a gcc extension, I can do this without a typedef:
class BB { operator typeof (int(*)())(); };
BB::operator typeof (int(*)())() { return 0; }
So this suggests that the demangler should be changed. When a
conversion operator is used with a complex type, the demangler should
demangle the name using `typeof'.
Ian
More information about the Gcc
mailing list