Jonathan Wakely <jwak...@redhat.com> writes:

> This adds move and swap functions to the iostream classes.
>
> Although this is a pretty large patch, it's a pure addition that only
> affects C++11 mode, and should have no effect on existing code because
> it won't be moving or swapping streams.
>
> I wanted to use C++14's std::exchange so I added std::__exchange to
> <bits/move.h> and made std::exchange forward to that.
>
> I needed to add a new constructor to basic_ostream that doesn't call
> init(0), for basic_iostream's move constructor to use.  (I wonder why
> our non-standard default constructors for basic_istream and
> basic_ostream call init(nullptr), rather than doing nothing.  Derived
> classes that want init(nullptr) to be called can do that by passing
> nullptr to the standard basic_istream and basic_ostream constructors
> taking a pointer, which would allow the default constructors to be
> re-purposed to intentionally leave the object uninitialized).
>
> To ensure that the explicit instantiations in the library include the
> new functions I had to move several files from src/c++98 to src/c++11,
> which makes the patch huge, so the new tests are in a separate,
> gzipped file to keep this post below the mailing list size limits.
>
> Tested x86_64-linux, committed to trunk.

This patch broke Solaris bootstrap with Sun ld: when linking
libstdc++.so, ld complains

ld: fatal: libstdc++-symbols.ver-sun: 4520: symbol 'std::basic_ios<char, 
std::char_traits<char> >::move(std::basic_ios<char, std::char_traits<char> 
>&&)': symbol version conflict

and many more.  In that case, I find that this symbols is matched by
both the GLIBCXX_3.4 and GLIBCXX_3.4.21 patterns:

    GLIBCXX_3.4
    ##std::basic_i[g-r]* (cxx)
    _ZNSt9basic_iosIcSt11char_traitsIcEE4moveEOS2_;

    GLIBCXX_3.4.21
    ##_ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE4moveE[OR]S2_ (glob)
    _ZNSt9basic_iosIcSt11char_traitsIcEE4moveEOS2_;

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to