This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [c++] Another question about demangler output
"Zack Weinberg" <zack@codesourcery.com> writes:
| Daniel Jacobowitz <drow@mvista.com> writes:
|
| >> | > if you use typeof to represent int (*)() in the demangled symbol, do
| >> | > you offer a way to distinguish it from the template instantiation with
| >> | > T = int (which is a different function)?
| >> |
| >> | Currently, an instantiation of the latter for T = double looks like:
| >> | foo::operator double (*)()<double>()
| >>
| >> Ah, I see. That isn't valid C++ either :-)
| >> (Besides the 'double (*)()' thingy that started this thread, there is
| >> no way to specify an explicit template argument for a conversion
| >> function, so the <double> annotation isn't valid either). Fun, fun.
| >
| > Right. Is there a valid way in C++ to represent the difference between
| > these?
| >
| > Otherwise it's yet another example of the demangler being compelled to
| > print out invalid C++, which is making everything quite gross.
|
| I am getting the impression that typedef and template constructs can
| produce classes of mangled names that simply cannot be represented by
| single expressions in conforming C++.
Yes, that is the case.
| If this is the case, then the alternatives would seem to be either
| printing out demangled expressions that are invalid C++ but
| comprehensible to a human, or else making up names as necessary and
| printing their definitions too. The latter seems like too much
| trouble, and liable to confuse humans more than the former.
Well, if it is invlid C++, it is not obvious that it would be
comprehensible to a human :-) For example, it has been proposed
struct A {
operator int (*)()();
};
But, it is not obvious that that should not have been
struct A {
operator int (*())();
};
or
struct A {
int (*operator())();
};
-- Gaby