[c++] Another question about demangler output
Daniel Jacobowitz
drow@mvista.com
Sun Dec 7 05:25:00 GMT 2003
On Sun, Dec 07, 2003 at 06:05:58AM +0100, Gabriel Dos Reis wrote:
> Ian Lance Taylor <ian@wasabisystems.com> writes:
>
> | Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
> |
> | > Ian Lance Taylor <ian@wasabisystems.com> writes:
> | >
> | > | Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
> | > |
> | > | > The point is this. "typeof" is a GNU/C++ extension. Its use in a
> | > | > function declaration should be mangled differently from any standard
> | > | > C++ construction. After all, the ABI has provided hook for vendor
> | > | > extension.
> | > |
> | > | So you are arguing that this is a bug in g++.
> | >
> | > Yes.
> | >
> | > | I don't agree. To me it seems natural that typeof should simply be
> | > | replaced by the resulting type when doing name mangling.
> | >
> | > Elsewhere, we seem to refrain from "folding". Which is what I
> | > referred to in an earlier message as a schizophrenic position.
> |
> | g++ refrains from folding in expressions which appear as template
> | arguments. I don't know whether that is right or wrong.
>
> Yes. Consider but the following case
>
> struct foo {
> typedef int (*bar)();
>
> operator bar();
>
> template<class T>
> operator typeof(T (*)());
> };
>
> 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>()
For int it would be:
foo::operator int (*)()<int>()
which is different from
foo::operator int (*)()()
With Ian's suggestion they would be, I believe:
foo::operator typeof(double (*)())<double>()
foo::operator typeof(int (*)())<int>()
foo::operator typeof(int (*)())()
How useful that difference is, I'm not sure.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
More information about the Gcc
mailing list