Re: [cxx-abi-dev] Possibly ambiguous mangling of extern "C" functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cxx-abi-dev] Possibly ambiguous mangling of extern "C" functions
- To: Michael Wong <michaelw@xxxxxxxxxx>, cxx-abi-dev@xxxxxxxxxxxxxxxx
- Subject: Re: [cxx-abi-dev] Possibly ambiguous mangling of extern "C" functions
- From: David Vandevoorde <daveed@xxxxxxx>
- Date: Tue, 19 Aug 2008 19:17:02 -0400
On Aug 19, 2008, at 9:12 AM, Michael Wong wrote:
The example in question is at the end of "5.1.5 Type encodings". of
http://www.codesourcery.com/public/cxx-abi/abi.html.
In this example, it is using an extern "C" function as a parameter
to a
class template. There are two problems:
1. Should there be full mangling, partial mangling, or no mangling
of the
extern 'C" function as a template parameter?
2. Should there be an X...E (after the I and before the L) since
there is
a <expr-primary> production under <template-arg> that makes that the
case.
Here is the example I actually used:
extern "C" bool IsEmpty(char *); // (un)mangled as IsEmpty
template<bool (&)(char *)> struct CB { static int x; };
// CB<IsEmpty> is mangled as "2CBIL_Z7IsEmptyEE"
int *p = &CB<IsEmpty>::x;
Normally, we issue the following error on that example:
"t.c", line 4: error: a reference of type "bool (&)(char *)" (not
const-qualified) cannot be initialized with a value of type
"bool (char *) C"
int *p = &CB<IsEmpty>::x;
^
which I think is right.
When I enable the emulation of GCC, we accept it and mangle it as
_ZN2CBIXL_Z7IsEmptyEEE1xE.
We also have a mode to emulate what we consider "GNU ABI bugs". When
I enable that, we generate _ZN2CBIXL7IsEmptyEEE1xE.
Daveed