Boost logo

Boost :

Subject: Re: [boost] ABI issues with -std
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2018-08-20 08:23:49


On 08/20/18 10:37, Olaf van der Spek wrote:
> On Sun, Aug 19, 2018 at 10:57 PM, Andrey Semashev via Boost
> <boost_at_[hidden]> wrote:
>> I solved this in Boost.Log this way:
>>
>> struct Y
>> {
>> void f( X const& x );
>>
>> #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
>>
>> void f( X&& x ) { f_move(x); }
>>
>> #endif
>>
>> private:
>> void f_move(X& x);
>> };
>
> Only works if void f( X&& x ) is inlined and even then it still
> violates ODR doesn't it?

If `f( X&& x )` is not inlined then it means it is ODR-used in the
user's code and left there as a standalone function. I don't see the
problem.

ODR is violated but not in the harmful way. ABI is the same, API is
99.9% compatible (leaving 0.1% for weird cases where you try to exchange
a pointer to Y::f between code bases for C++03 and C++11).

>> As a slightly different variant of the Boost.System2 solution, I can
>> suggest building multiple Boost.System binaries, one per ABI we can
>> support.
>
> That'd require library name mangling on Linux and adding the std level
> to the name..

Not necessarilly. The base name of Boost.System with the new ABI could
be different.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk