This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __cxa_demangle

> _Z1fM1AKFivE -> _Z1fM1AKFivE, should be: f(int (A::*)() const)

Blah, you can't blame me for this either :/

The compiler changed the way this is mangled!!!
Previous versions of the compiler (ie 3.0.4) mangled this as


And that works fine:

~/c++/demangler>dt _Z1fMK1AFivE
f(int (A::*)(void) const)

The current 3.2 (and 3.1) mangle it indeed as


Note the comments in my code saying:

  // The ABI specifies for pointer-to-member function types the format <Q>M<T>F<R><B>E.  In other words,
  // the qualifier <Q2> (see above) is implicitely contained in <T> instead of explicitly part of the M
  // format.  I am convinced that this is a bug in the ABI.  Unfortunately, this is how we have to
  // demangle things as it has a direct impact on the order in which substitutions are stored.
  // This ill-formed design results in rather ill-formed demangler code too however :/

I reported this to the ABI guys - and apparently they
changed it (due to my comment, or not).

The description on
is *certainly* changed, because now it literally says that

  Note that for a pointer to cv-qualified member function, the qualifiers are attached to the function type, so

    struct A;
    void f (void (A::*)() const) {}

  produces the mangled name "_Z1fM1AKFvvE".

I suppose that was added later as a result of the fact
that certain compiler vendors had implemented it wrongly :p

Unfortunately, changing back ill-formed code to nice code is
as hard as making it ill formed in the first place.

I'll need some time to fix this...

Carlo Wood <>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]