Re: Incorrect demangling

On Wed, Apr 25, 2012 at 09:33:01PM -0700, Alan Barrett wrote:
> >So it looks like you won't convince the GCC maintainers in
> >changing the compiler. Plus, PCC and CLANG will probably give you
> >similar problems.
>
> It looks as though anything that performs demangling should have
> some way other than the symbol name of figuring out whether the
> symbol came from C++, so that it is not tripped up by valid C
> symbols that happen to mean something special when viewed as C++
> symbols.
It can't. Just look at the history of C++ and the way it has always been
implemented. On most systems it is simply not possible to use
non-C-compatible identifiers as result of the mangling, because the
assembler or linker would reject them. There is no bug here. Newer ld
defaults to mangling off again. It is purely cosmetic anyway. If you
want to use C and C++ in the same program, you either *depend* on being
able to create functions that can be used from C++ (including
overloading etc) or you will get a linker complain about redefinition on
accidental matches.
Joerg