Dealing with C++98/11 ABI incompatibilities

Jason Merrill
Wed Oct 31 20:10:00 GMT 2012

On 07/03/2012 03:18 PM, Jason Merrill wrote:
> 2) Object layout changes to std::list and std::basic_string.  For these
> types, there is no way to both retain backward compatibility with older
> C++98 code and conform to the C++11 standard.  The best we can hope for
> is to allow old code to coexist with new code so long as they don't try
> to touch the same string/list objects.
> As above, one solution to this would be to change the linkage name of
> the new versions so that they don't clash with the old versions.  But
> that isn't enough in this case, as it wouldn't affect the linkage name
> of a class like
> struct Wrap { std::string s; };
> so we would need some way to cause the name decoration to propagate to
> other containing/derived classes.

I raised this issue on the ABI list, and someone pointed out to me that 
incomplete classes make quiet propagation impossible; any full 
coexistence solution will require changes to affected user types.  There 
seem to be two options:

1) No propagation, add a warning to suggest that users decorate their 
types appropriately.
2) Propagate to class definitions, give an error if there was an earlier 
forward declaration without the appropriate tag.

I lean toward #1; people who rebuild everything regularly won't be 
affected by it, and people who need coexistence can use the warning flag 
to help them adjust.


More information about the Libstdc++ mailing list