C++ ABI: Mangling of call_expr

Giovanni Bajo giovannibajo@libero.it
Tue Jun 24 16:18:00 GMT 2003


Nathan Sidwell <nathan@codesourcery.com> wrote:

>>> looks like a bug in the ABI spec. To be demanglable, there must be a
count
>>> of the number of parameters encoded.
>>> Mark, have I missed something?
>>
>>
>> Since we are at it, I think the ABI is also missing a description of how
to
>> mangle a call to a constructor.

> Isn't that just the same as a call with a funny name?

I don't know. Since there is nothing specified, yes, I think we should
encode it like a function call where the name happens to name a type instead
of a function. But I think it wouldn't hurt if the ABI would say this
explicitally.

> It's missing a description of all member function calls, and of calls like
> (expr).Foo ();
> where Foo turns out to be a static member -- where do I put the mangling
> for 'expr'?

You're right, I thought '.' was defined among the operators, like "->". As
Andreas noted, it's the mangling of a whole postfix-expression which is
unclear.
And it doesn't apply only for static members. Consider:

template <int>
struct A
{
    double foo(int);
    float foo(char*);
};

template <>
struct A<0>
{
    char foo(int);
    long foo(char*);
};

template <int N>
A<sizeof(A<N>().foo(123))> func(void)
{}

int main()
{
  func<0>();
  func<1>();
}

This does not compile only because of the (missing) expression mangling.

Giovanni Bajo



More information about the Gcc mailing list