This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[c++] Another question about demangler output
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 6 Dec 2003 18:59:18 -0500
- Subject: [c++] Another question about demangler output
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 (*)()()
But that output is quite annoying for me, because it's nothing like legal
C++, as far as I have been able to tell. But I can't find a way to express
that type without using an intermediate typedef.
The reason this bugs me is that I've been writing a fairly dumb "parser" for
things which can appear in symbol names, with the goal of creating a
canonical form for such names for GDB's use. The problem is in some ways
easier and in some ways harder than parsing C++; we don't need to
differentiate between various possible meanings for identifiers, but at the
same time we _can't_ differentiate between them. I've found no reasonable
way for it to figure out what "A::operator int (*)()()" means.
Am I right that this can't be expressed in C++ without using an intermediate
type? If I am right, I'm not sure what to do. If I'm wrong, we can correct
the demangler.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer