mangling template args with C linkage
Jim Dehnert
dehnert at baalbek.engr.sgi.com
Wed Apr 12 01:31:47 UTC 2000
> From: Alex Samuel <samuel at codesourcery.com>
>
> Mangling question. Suppose you have:
>
> template<void (* P) (void)> class TemplateClass {};
>
> extern "C" void foo (void);
>
> TemplateClass<&foo> x;
>
> Does the template argument foo get mangled as "foo" or "3foov"? The
> production
>
> <template-arg> ::= LZ <encoding> E
>
> would seem to imply the second, but it seems odd to mangle the name of
> a function with C linkage.
We haven't explicitly decided, but I think the answer is neither.
It serves no purpose to do a full mangling, so I don't like 3foov.
But it can't be unmangled, since we have to be able to find the end
(think about extern "C" bool IsEmpty (void), as LZIsEmptyE...).
So I think the answer is to treat it like a global data object, and
mangle it as its <source-name>, i.e. LZ7IsEmptyE. I've put this
specification in the document -- object if you don't like it.
Jim
- Jim Dehnert dehnert at sgi.com
(650)933-4272
More information about the cxx-abi-dev
mailing list