Consider this C++ code:

template<typename T>
class c {
 public:
  T* operator->() const;
  T* p;
};
struct s { int v; };
template<> s* c<s>::operator->() const { return p; }
int fn(c<s> p) { return p->v; }

Compiling this with g++ 4.3 gives me the symbol

_ZNK1cI1sEptEv

That is the symbol which is called by the function fn.

Compiling this with current mainline gives me the symbol

_ZNK1cI1sEdtEv

Note that the "pt" changed to a "dt".  Again, that is the symbol called by the
function fn.

This seems to me to be an ABI change.  It means that if I put the class c in a
library compiled with gcc 4.3, and try to link it with the function fn compiled
with gcc 4.4, I will get an undefined symbol error.

Why did the mangling change?  It seems to me that this change should be
reverted before gcc 4.4 is released.


-- 
           Summary: C++ mangling change seems to break ABI
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ian at airs dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39122

Reply via email to