+2014-09-19 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/54316
+ PR libstdc++/53626
+ * config/abi/pre/gnu.ver: Add new exports.
+ * config/io/basic_file_stdio.h (__basic_file): Support moving and
+ swapping.
+ * include/bits/basic_ios.h (basic_ios::move, basic_ios::swap):
+ Likewise.
+ * include/bits/ios_base.h (ios_base::_M_move, ios_base::_M_swap):
+ Likewise.
+ * include/bits/fstream.tcc (basic_filebuf): Likewise.
+ * include/bits/move.h (__exchange): Define for C++11 mode.
+ * include/ext/stdio_filebuf.h (stdio_filebuf): Support moving and
+ swapping.
+ * include/ext/stdio_sync_filebuf.h (stdio_sync_filebuf): Likewise.
+ * include/std/fstream (basic_filebuf, basic_ifstream, basic_ofstream,
+ basic_fstream): Likewise.
+ * include/std/ios: Remove whitespace.
+ * include/std/istream (basic_istream, basic_iostream): Support moving
+ and swapping.
+ * include/std/ostream (basic_ostream): Likewise.
+ * include/std/sstream (basic_stringbuf, basic_istringstream,
+ basic_ostringstream, basic_stringstream): Likewise.
+ * include/std/streambuf (basic_streambuf): Do not default copy
+ constructor and assignment on first declaration.
+ * include/std/utility (exchange): Forward to __exchange.
+ * testsuite/27_io/basic_filebuf/cons/char/copy_neg.cc: New.
+ * src/c++11/Makefile.am: Add stream-related files.
+ * src/c++11/Makefile.in: Regenerate.
+ * src/c++11/ext11-inst.cc (stdio_filebuf, stdio_sync_filebuf):
+ New file for explicit instantiation definitions.
+ * src/c++11/ios.cc: Move from src/c++98 to here.
+ (ios_base::_M_move, ios_base::_M_swap): Define.
+ * src/c++11/ios-inst.cc: Move from src/c++98 to here.
+ * src/c++11/iostream-inst.cc: Likewise.
+ * src/c++11/istream-inst.cc: Likewise.
+ * src/c++11/ostream-inst.cc: Likewise.
+ * src/c++11/sstream-inst.cc: Likewise.
+ * src/c++11/streambuf-inst.cc: Likewise.
+ * src/c++98/Makefile.am: Remove stream-related files.
+ * src/c++98/Makefile.in: Regenerate.
+ * src/c++98/ext-inst.cc (stdio_filebuf): Remove explicit
+ instantiations.
+ * src/c++98/misc-inst.cc (stdio_sync_filebuf): Likewise.
+ * src/c++98/ios-inst.cc: Move to src/c++11/.
+ * src/c++98/ios.cc: Move to src/c++11/.
+ * src/c++98/iostream-inst.cc: Likewise.
+ * src/c++98/istream-inst.cc: Likewise.
+ * src/c++98/ostream-inst.cc: Likewise.
+ * src/c++98/sstream-inst.cc: Likewise.
+ * src/c++98/streambuf-inst.cc: Likewise.
+ * testsuite/27_io/basic_filebuf/cons/char/copy_neg.cc: New.
+ * testsuite/27_io/basic_fstream/cons/move.cc: New.
+ * testsuite/27_io/basic_fstream/assign/1.cc: New.
+ * testsuite/27_io/basic_ifstream/cons/move.cc: New.
+ * testsuite/27_io/basic_ifstream/assign/1.cc: New.
+ * testsuite/27_io/basic_istringstream/assign/1.cc: New.
+ * testsuite/27_io/basic_istringstream/cons/move.cc: New.
+ * testsuite/27_io/basic_ofstream/cons/move.cc: New.
+ * testsuite/27_io/basic_ofstream/assign/1.cc: New.
+ * testsuite/27_io/basic_ostringstream/assign/1.cc: New.
+ * testsuite/27_io/basic_ostringstream/cons/move.cc: New.
+ * testsuite/27_io/basic_stringstream/assign/1.cc: New.
+ * testsuite/27_io/basic_stringstream/cons/move.cc: New.
+
2014-09-17 Jason Merrill <jason@redhat.com>
* libsupc++/dyncast.cc (__dynamic_cast): Handle mid-destruction
_ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE6stosscEv;
_ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE4syncEv;
- _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE[5-9C]*;
+ _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EE[5-9]*;
+ _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEC[12]EP*;
_ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EED[^2]*;
} GLIBCXX_3.4.9;
# void std::thread::_M_start_thread(__shared_base_type, void(*)())
_ZNSt6thread15_M_start_threadESt10shared_ptrINS_10_Impl_baseEEPFvvE;
+ # Move/swap functions for iostreams
+ _ZNSt8ios_base7_M_swapERS_;
+ _ZNSt8ios_base7_M_moveERS_;
+ _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE4moveE[OR]S2_;
+ _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE4swapERS2_;
+ _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE9set_rdbuf*;
+ _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE4swapERS2_;
+ _ZNS[dio]4swapERS[dio];
+ _ZNS[dio]aSEOS[dio];
+ _ZNS[dio]C[12]EOS[dio];
+ _ZNSt13basic_[io]streamIwSt11char_traitsIwEE4swapERS2_;
+ _ZNSt13basic_[io]streamIwSt11char_traitsIwEEaSEOS2_;
+ _ZNSt13basic_[io]streamIwSt11char_traitsIwEEC[12]EOS2_;
+ _ZNSt14basic_iostreamIwSt11char_traitsIwEE4swapERS2_;
+ _ZNSt14basic_iostreamIwSt11char_traitsIwEEaSEOS2_;
+ _ZNSt14basic_iostreamIwSt11char_traitsIwEEC[12]EOS2_;
+ _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE4swapERS2_;
+ _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EEaSEOS2_;
+ _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EEC[12]EOS2_;
+ _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EE4swapERS2_;
+ _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEaSEOS2_;
+ _ZNSt13basic_fstreamI[cw]St11char_traitsI[cw]EEC[12]EOS2_;
+ _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EE4swapERS2_;
+ _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EEaSEOS2_;
+ _ZNSt14basic_[io]fstreamI[cw]St11char_traitsI[cw]EEC[12]EOS2_;
+ _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE4swapERS3_;
+ _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEaSEOS3_;
+ _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS3_;
+ _ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE4swapERS3_;
+ _ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEaSEOS3_;
+ _ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS3_;
+ _ZNSt19basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE4swapERS3_;
+ _ZNSt19basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEaSEOS3_;
+ _ZNSt19basic_[io]stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]EOS3_;
+ _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEaSEOS3_;
+ _ZN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEC[12]EOS3_;
+
+ # basic_ostream<C,T>::basic_ostream(basic_iostream<C,T>*)
+ _ZNSoC[12]EPSd;
+ _ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]EPSt14basic_iostreamIwS1_E;
+
} GLIBCXX_3.4.20;
#include <bits/c++config.h>
#include <bits/c++io.h> // for __c_lock and __c_file
+#include <bits/move.h> // for swap
#include <ios>
namespace std _GLIBCXX_VISIBILITY(default)
public:
__basic_file(__c_lock* __lock = 0) throw ();
+#if __cplusplus >= 201103L
+ __basic_file(__basic_file&& __rv, __c_lock* __lock = 0) noexcept
+ : _M_cfile(__rv._M_cfile), _M_cfile_created(__rv._M_cfile_created)
+ {
+ __rv._M_cfile = nullptr;
+ __rv._M_cfile_created = false;
+ }
+
+ __basic_file& operator=(const __basic_file&) = delete;
+ __basic_file& operator=(__basic_file&&) = delete;
+
+ void
+ swap(__basic_file& __f) noexcept
+ {
+ std::swap(_M_cfile, __f._M_cfile);
+ std::swap(_M_cfile_created, __f._M_cfile_created);
+ }
+#endif
+
__basic_file*
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
#include <bits/locale_classes.h>
#include <bits/locale_facets.h>
#include <bits/streambuf_iterator.h>
+#include <bits/move.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
void
init(basic_streambuf<_CharT, _Traits>* __sb);
+#if __cplusplus >= 201103L
+ basic_ios(const basic_ios&) = delete;
+ basic_ios& operator=(const basic_ios&) = delete;
+
+ void
+ move(basic_ios& __rhs)
+ {
+ ios_base::_M_move(__rhs);
+ _M_cache_locale(_M_ios_locale);
+ this->tie(__rhs.tie(nullptr));
+ _M_fill = __rhs._M_fill;
+ _M_fill_init = __rhs._M_fill_init;
+ _M_streambuf = nullptr;
+ }
+
+ void
+ move(basic_ios&& __rhs)
+ { this->move(__rhs); }
+
+ void
+ swap(basic_ios& __rhs) noexcept
+ {
+ ios_base::_M_swap(__rhs);
+ _M_cache_locale(_M_ios_locale);
+ __rhs._M_cache_locale(__rhs._M_ios_locale);
+ std::swap(_M_tie, __rhs._M_tie);
+ std::swap(_M_fill, __rhs._M_fill);
+ std::swap(_M_fill_init, __rhs._M_fill_init);
+ }
+
+ void
+ set_rdbuf(basic_streambuf<_CharT, _Traits>* __sb)
+ { _M_streambuf = __sb; }
+#endif
+
void
_M_cache_locale(const locale& __loc);
};
#pragma GCC system_header
#include <bits/cxxabi_forced.h>
+#include <bits/move.h> // for swap
namespace std _GLIBCXX_VISIBILITY(default)
{
_M_codecvt = &use_facet<__codecvt_type>(this->_M_buf_locale);
}
+#if __cplusplus >= 201103L
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>::
+ basic_filebuf(basic_filebuf&& __rhs)
+ : __streambuf_type(__rhs),
+ _M_lock(), _M_file(std::move(__rhs._M_file), &_M_lock),
+ _M_mode(std::__exchange(__rhs._M_mode, ios_base::openmode(0))),
+ _M_state_beg(std::move(__rhs._M_state_beg)),
+ _M_state_cur(std::move(__rhs._M_state_cur)),
+ _M_state_last(std::move(__rhs._M_state_last)),
+ _M_buf(std::__exchange(__rhs._M_buf, nullptr)),
+ _M_buf_size(std::__exchange(__rhs._M_buf_size, 1)),
+ _M_buf_allocated(std::__exchange(__rhs._M_buf_allocated, false)),
+ _M_reading(std::__exchange(__rhs._M_reading, false)),
+ _M_writing(std::__exchange(__rhs._M_writing, false)),
+ _M_pback(__rhs._M_pback),
+ _M_pback_cur_save(std::__exchange(__rhs._M_pback_cur_save, nullptr)),
+ _M_pback_end_save(std::__exchange(__rhs._M_pback_end_save, nullptr)),
+ _M_pback_init(std::__exchange(__rhs._M_pback_init, false)),
+ _M_codecvt(__rhs._M_codecvt),
+ _M_ext_buf(std::__exchange(__rhs._M_ext_buf, nullptr)),
+ _M_ext_buf_size(std::__exchange(__rhs._M_ext_buf_size, 0)),
+ _M_ext_next(std::__exchange(__rhs._M_ext_next, nullptr)),
+ _M_ext_end(std::__exchange(__rhs._M_ext_end, nullptr))
+ {
+ __rhs._M_set_buffer(-1);
+ __rhs._M_state_last = __rhs._M_state_cur = __rhs._M_state_beg;
+ }
+
+ template<typename _CharT, typename _Traits>
+ basic_filebuf<_CharT, _Traits>&
+ basic_filebuf<_CharT, _Traits>::
+ operator=(basic_filebuf&& __rhs)
+ {
+ this->close();
+ __streambuf_type::operator=(__rhs);
+ _M_file.swap(__rhs._M_file);
+ _M_mode = std::__exchange(__rhs._M_mode, ios_base::openmode(0));
+ _M_state_beg = std::move(__rhs._M_state_beg);
+ _M_state_cur = std::move(__rhs._M_state_cur);
+ _M_state_last = std::move(__rhs._M_state_last);
+ _M_buf = std::__exchange(__rhs._M_buf, nullptr);
+ _M_buf_size = std::__exchange(__rhs._M_buf_size, 1);
+ _M_buf_allocated = std::__exchange(__rhs._M_buf_allocated, false);
+ _M_ext_buf = std::__exchange(__rhs._M_ext_buf, nullptr);
+ _M_ext_buf_size = std::__exchange(__rhs._M_ext_buf_size, 0);
+ _M_ext_next = std::__exchange(__rhs._M_ext_next, nullptr);
+ _M_ext_end = std::__exchange(__rhs._M_ext_end, nullptr);
+ _M_reading = std::__exchange(__rhs._M_reading, false);
+ _M_writing = std::__exchange(__rhs._M_writing, false);
+ _M_pback_cur_save = std::__exchange(__rhs._M_pback_cur_save, nullptr);
+ _M_pback_end_save = std::__exchange(__rhs._M_pback_end_save, nullptr);
+ _M_pback_init = std::__exchange(__rhs._M_pback_init, false);
+ __rhs._M_set_buffer(-1);
+ __rhs._M_state_last = __rhs._M_state_cur = __rhs._M_state_beg;
+ return *this;
+ }
+
+ template<typename _CharT, typename _Traits>
+ void
+ basic_filebuf<_CharT, _Traits>::
+ swap(basic_filebuf& __rhs)
+ {
+ __streambuf_type::swap(__rhs);
+ _M_file.swap(__rhs._M_file);
+ std::swap(_M_mode, __rhs._M_mode);
+ std::swap(_M_state_beg, __rhs._M_state_beg);
+ std::swap(_M_state_cur, __rhs._M_state_cur);
+ std::swap(_M_state_last, __rhs._M_state_last);
+ std::swap(_M_buf, __rhs._M_buf);
+ std::swap(_M_buf_size, __rhs._M_buf_size);
+ std::swap(_M_buf_allocated, __rhs._M_buf_allocated);
+ std::swap(_M_ext_buf, __rhs._M_ext_buf);
+ std::swap(_M_ext_buf_size, __rhs._M_ext_buf_size);
+ std::swap(_M_ext_next, __rhs._M_ext_next);
+ std::swap(_M_ext_end, __rhs._M_ext_end);
+ std::swap(_M_reading, __rhs._M_reading);
+ std::swap(_M_writing, __rhs._M_writing);
+ std::swap(_M_pback_cur_save, __rhs._M_pback_cur_save);
+ std::swap(_M_pback_end_save, __rhs._M_pback_end_save);
+ std::swap(_M_pback_init, __rhs._M_pback_init);
+ }
+#endif
+
template<typename _CharT, typename _Traits>
typename basic_filebuf<_CharT, _Traits>::__filebuf_type*
basic_filebuf<_CharT, _Traits>::
ios_base&
operator=(const ios_base&) = delete;
+
+ protected:
+ void
+ _M_move(ios_base&) noexcept;
+
+ void
+ _M_swap(ios_base& __rhs) noexcept;
#endif
};
addressof(_Tp& __r) noexcept
{ return std::__addressof(__r); }
+ // C++11 version of std::exchange for internal use.
+ template <typename _Tp, typename _Up = _Tp>
+ inline _Tp
+ __exchange(_Tp& __obj, _Up&& __new_val)
+ {
+ _Tp __old_val = std::move(__obj);
+ __obj = std::forward<_Up>(__new_val);
+ return __old_val;
+ }
+
/// @} group utilities
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
virtual
~stdio_filebuf();
+#if __cplusplus >= 201103L
+ stdio_filebuf(stdio_filebuf&&) = default;
+ stdio_filebuf& operator=(stdio_filebuf&&) = default;
+
+ void
+ swap(stdio_filebuf& __fb)
+ { std::basic_filebuf<_CharT, _Traits>::swap(__fb); }
+#endif
+
/**
* @return The underlying file descriptor.
*
#include <unistd.h>
#include <cstdio>
#include <bits/c++io.h> // For __c_file
+#include <bits/move.h> // For __exchange
#ifdef _GLIBCXX_USE_WCHAR_T
#include <cwchar>
typedef typename traits_type::off_type off_type;
private:
+ typedef std::basic_streambuf<_CharT, _Traits> __streambuf_type;
+
// Underlying stdio FILE
- std::__c_file* const _M_file;
+ std::__c_file* _M_file;
// Last character gotten. This is used when pbackfail is
// called from basic_streambuf::sungetc()
: _M_file(__f), _M_unget_buf(traits_type::eof())
{ }
+#if __cplusplus >= 201103L
+ stdio_sync_filebuf(stdio_sync_filebuf&& __fb) noexcept
+ : __streambuf_type(std::move(__fb)),
+ _M_file(__fb._M_file), _M_unget_buf(__fb._M_unget_buf)
+ {
+ __fb._M_file = nullptr;
+ __fb._M_unget_buf = traits_type::eof();
+ }
+
+ stdio_sync_filebuf&
+ operator=(stdio_sync_filebuf&& __fb) noexcept
+ {
+ __streambuf_type::operator=(__fb);
+ _M_file = std::__exchange(__fb._M_file, nullptr);
+ _M_unget_buf = std::__exchange(__fb._M_unget_buf, traits_type::eof());
+ return *this;
+ }
+
+ void
+ swap(stdio_sync_filebuf& __fb)
+ {
+ __streambuf_type::swap(__fb);
+ std::swap(_M_file, __fb._M_file);
+ std::swap(_M_unget_buf, __fb._M_unget_buf);
+ }
+#endif
+
/**
* @return The underlying FILE*.
*
__state_type _M_state_last;
/// Pointer to the beginning of internal buffer.
- char_type* _M_buf;
+ char_type* _M_buf;
/**
* Actual size of internal buffer. This number is equal to the size
*/
basic_filebuf();
+#if __cplusplus >= 201103L
+ basic_filebuf(const basic_filebuf&) = delete;
+ basic_filebuf(basic_filebuf&&);
+#endif
+
/**
* @brief The destructor closes the file first.
*/
~basic_filebuf()
{ this->close(); }
+#if __cplusplus >= 201103L
+ basic_filebuf& operator=(const basic_filebuf&) = delete;
+ basic_filebuf& operator=(basic_filebuf&&);
+ void swap(basic_filebuf&);
+#endif
+
// Members:
/**
* @brief Returns true if the external file is open.
this->init(&_M_filebuf);
this->open(__s, __mode);
}
+
+ basic_ifstream(const basic_ifstream&) = delete;
+
+ basic_ifstream(basic_ifstream&& __rhs)
+ : __istream_type(std::move(__rhs)),
+ _M_filebuf(std::move(__rhs._M_filebuf))
+ { __istream_type::set_rdbuf(&_M_filebuf); }
#endif
/**
~basic_ifstream()
{ }
+#if __cplusplus >= 201103L
+ // 27.8.3.2 Assign and swap:
+
+ basic_ifstream&
+ operator=(const basic_ifstream&) = delete;
+
+ basic_ifstream&
+ operator=(basic_ifstream&& __rhs)
+ {
+ __istream_type::operator=(std::move(__rhs));
+ _M_filebuf = std::move(__rhs._M_filebuf);
+ return *this;
+ }
+
+ void
+ swap(basic_ifstream& __rhs)
+ {
+ __istream_type::swap(__rhs);
+ _M_filebuf.swap(__rhs._M_filebuf);
+ }
+#endif
+
// Members:
/**
* @brief Accessing the underlying buffer.
this->init(&_M_filebuf);
this->open(__s, __mode);
}
+
+ basic_ofstream(const basic_ofstream&) = delete;
+
+ basic_ofstream(basic_ofstream&& __rhs)
+ : __ostream_type(std::move(__rhs)),
+ _M_filebuf(std::move(__rhs._M_filebuf))
+ { __ostream_type::set_rdbuf(&_M_filebuf); }
#endif
/**
~basic_ofstream()
{ }
+#if __cplusplus >= 201103L
+ // 27.8.3.2 Assign and swap:
+
+ basic_ofstream&
+ operator=(const basic_ofstream&) = delete;
+
+ basic_ofstream&
+ operator=(basic_ofstream&& __rhs)
+ {
+ __ostream_type::operator=(std::move(__rhs));
+ _M_filebuf = std::move(__rhs._M_filebuf);
+ return *this;
+ }
+
+ void
+ swap(basic_ofstream& __rhs)
+ {
+ __ostream_type::swap(__rhs);
+ _M_filebuf.swap(__rhs._M_filebuf);
+ }
+#endif
+
// Members:
/**
* @brief Accessing the underlying buffer.
this->init(&_M_filebuf);
this->open(__s, __mode);
}
+
+ basic_fstream(const basic_fstream&) = delete;
+
+ basic_fstream(basic_fstream&& __rhs)
+ : __iostream_type(std::move(__rhs)),
+ _M_filebuf(std::move(__rhs._M_filebuf))
+ { __iostream_type::set_rdbuf(&_M_filebuf); }
#endif
/**
~basic_fstream()
{ }
+#if __cplusplus >= 201103L
+ // 27.8.3.2 Assign and swap:
+
+ basic_fstream&
+ operator=(const basic_fstream&) = delete;
+
+ basic_fstream&
+ operator=(basic_fstream&& __rhs)
+ {
+ __iostream_type::operator=(std::move(__rhs));
+ _M_filebuf = std::move(__rhs._M_filebuf);
+ return *this;
+ }
+
+ void
+ swap(basic_fstream& __rhs)
+ {
+ __iostream_type::swap(__rhs);
+ _M_filebuf.swap(__rhs._M_filebuf);
+ }
+#endif
+
// Members:
/**
* @brief Accessing the underlying buffer.
}
};
+#if __cplusplus >= 201103L
+ /// Swap specialization for filebufs.
+ template <class _CharT, class _Traits>
+ inline void
+ swap(basic_filebuf<_CharT, _Traits>& __x,
+ basic_filebuf<_CharT, _Traits>& __y)
+ { __x.swap(__y); }
+
+ /// Swap specialization for ifstreams.
+ template <class _CharT, class _Traits>
+ inline void
+ swap(basic_ifstream<_CharT, _Traits>& __x,
+ basic_ifstream<_CharT, _Traits>& __y)
+ { __x.swap(__y); }
+
+ /// Swap specialization for ofstreams.
+ template <class _CharT, class _Traits>
+ inline void
+ swap(basic_ofstream<_CharT, _Traits>& __x,
+ basic_ofstream<_CharT, _Traits>& __y)
+ { __x.swap(__y); }
+
+ /// Swap specialization for fstreams.
+ template <class _CharT, class _Traits>
+ inline void
+ swap(basic_fstream<_CharT, _Traits>& __x,
+ basic_fstream<_CharT, _Traits>& __y)
+ { __x.swap(__y); }
+#endif
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#include <bits/char_traits.h> // For char_traits, streamoff, streamsize, fpos
#include <bits/localefwd.h> // For class locale
#include <bits/ios_base.h> // For ios_base declarations.
-#include <streambuf>
+#include <streambuf>
#include <bits/basic_ios.h>
#endif /* _GLIBCXX_IOS */
: _M_gcount(streamsize(0))
{ this->init(0); }
+#if __cplusplus >= 201103L
+ basic_istream(const basic_istream&) = delete;
+
+ basic_istream(basic_istream&& __rhs)
+ : __ios_type(), _M_gcount(__rhs._M_gcount)
+ {
+ __ios_type::move(__rhs);
+ __rhs._M_gcount = 0;
+ }
+
+ // 27.7.3.3 Assign/swap
+
+ basic_istream& operator=(const basic_istream&) = delete;
+
+ basic_istream&
+ operator=(basic_istream&& __rhs)
+ {
+ swap(__rhs);
+ return *this;
+ }
+
+ void
+ swap(basic_istream& __rhs)
+ {
+ __ios_type::swap(__rhs);
+ std::swap(_M_gcount, __rhs._M_gcount);
+ }
+#endif
+
template<typename _ValueT>
__istream_type&
_M_extract(_ValueT& __v);
protected:
basic_iostream()
: __istream_type(), __ostream_type() { }
+
+#if __cplusplus >= 201103L
+ basic_iostream(const basic_iostream&) = delete;
+
+ basic_iostream(basic_iostream&& __rhs)
+ : __istream_type(std::move(__rhs)), __ostream_type(this)
+ { }
+
+ // 27.7.3.3 Assign/swap
+
+ basic_iostream& operator=(const basic_iostream&) = delete;
+
+ basic_iostream&
+ operator=(basic_iostream&& __rhs)
+ {
+ swap(__rhs);
+ return *this;
+ }
+
+ void
+ swap(basic_iostream& __rhs)
+ { __istream_type::swap(__rhs); }
+#endif
};
/**
basic_ostream()
{ this->init(0); }
+#if __cplusplus >= 201103L
+ // Non-standard constructor that does not call init()
+ basic_ostream(basic_iostream<_CharT, _Traits>*) { }
+
+ basic_ostream(const basic_ostream&) = delete;
+
+ basic_ostream(basic_ostream&& __rhs)
+ : __ios_type()
+ { __ios_type::move(__rhs); }
+
+ // 27.7.3.3 Assign/swap
+
+ basic_ostream& operator=(const basic_ostream&) = delete;
+
+ basic_ostream&
+ operator=(basic_ostream&& __rhs)
+ {
+ swap(__rhs);
+ return *this;
+ }
+
+ void
+ swap(basic_ostream& __rhs)
+ { __ios_type::swap(__rhs); }
+#endif
+
template<typename _ValueT>
__ostream_type&
_M_insert(_ValueT __v);
: __streambuf_type(), _M_mode(), _M_string(__str.data(), __str.size())
{ _M_stringbuf_init(__mode); }
+#if __cplusplus >= 201103L
+ basic_stringbuf(const basic_stringbuf&) = delete;
+
+ basic_stringbuf(basic_stringbuf&& __rhs)
+ : __streambuf_type(static_cast<const __streambuf_type&>(__rhs)),
+ _M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string))
+ { __rhs._M_stringbuf_init(__rhs._M_mode); }
+
+ // 27.8.2.2 Assign and swap:
+
+ basic_stringbuf&
+ operator=(const basic_stringbuf&) = delete;
+
+ basic_stringbuf&
+ operator=(basic_stringbuf&& __rhs)
+ {
+ const __streambuf_type& __base = __rhs;
+ __streambuf_type::operator=(__base);
+ this->pubimbue(__rhs.getloc());
+ _M_mode = __rhs._M_mode;
+ _M_string = std::move(__rhs._M_string);
+ __rhs._M_stringbuf_init(__rhs._M_mode);
+ return *this;
+ }
+
+ void
+ swap(basic_stringbuf& __rhs)
+ {
+ __streambuf_type& __base = __rhs;
+ __streambuf_type::swap(__base);
+ __rhs.pubimbue(this->pubimbue(__rhs.getloc()));
+ std::swap(_M_mode, __rhs._M_mode);
+ std::swap(_M_string, __rhs._M_string);
+ }
+#endif
+
// Get and set:
/**
* @brief Copying out the string buffer.
~basic_istringstream()
{ }
+#if __cplusplus >= 201103L
+ basic_istringstream(const basic_istringstream&) = delete;
+
+ basic_istringstream(basic_istringstream&& __rhs)
+ : __istream_type(std::move(__rhs)),
+ _M_stringbuf(std::move(__rhs._M_stringbuf))
+ { __istream_type::set_rdbuf(&_M_stringbuf); }
+
+ // 27.8.3.2 Assign and swap:
+
+ basic_istringstream&
+ operator=(const basic_istringstream&) = delete;
+
+ basic_istringstream&
+ operator=(basic_istringstream&& __rhs)
+ {
+ __istream_type::operator=(std::move(__rhs));
+ _M_stringbuf = std::move(__rhs._M_stringbuf);
+ return *this;
+ }
+
+ void
+ swap(basic_istringstream& __rhs)
+ {
+ __istream_type::swap(__rhs);
+ _M_stringbuf.swap(__rhs._M_stringbuf);
+ }
+#endif
+
// Members:
/**
* @brief Accessing the underlying buffer.
~basic_ostringstream()
{ }
+#if __cplusplus >= 201103L
+ basic_ostringstream(const basic_ostringstream&) = delete;
+
+ basic_ostringstream(basic_ostringstream&& __rhs)
+ : __ostream_type(std::move(__rhs)),
+ _M_stringbuf(std::move(__rhs._M_stringbuf))
+ { __ostream_type::set_rdbuf(&_M_stringbuf); }
+
+ // 27.8.3.2 Assign and swap:
+
+ basic_ostringstream&
+ operator=(const basic_ostringstream&) = delete;
+
+ basic_ostringstream&
+ operator=(basic_ostringstream&& __rhs)
+ {
+ __ostream_type::operator=(std::move(__rhs));
+ _M_stringbuf = std::move(__rhs._M_stringbuf);
+ return *this;
+ }
+
+ void
+ swap(basic_ostringstream& __rhs)
+ {
+ __ostream_type::swap(__rhs);
+ _M_stringbuf.swap(__rhs._M_stringbuf);
+ }
+#endif
+
// Members:
/**
* @brief Accessing the underlying buffer.
~basic_stringstream()
{ }
+#if __cplusplus >= 201103L
+ basic_stringstream(const basic_stringstream&) = delete;
+
+ basic_stringstream(basic_stringstream&& __rhs)
+ : __iostream_type(std::move(__rhs)),
+ _M_stringbuf(std::move(__rhs._M_stringbuf))
+ { __iostream_type::set_rdbuf(&_M_stringbuf); }
+
+ // 27.8.3.2 Assign and swap:
+
+ basic_stringstream&
+ operator=(const basic_stringstream&) = delete;
+
+ basic_stringstream&
+ operator=(basic_stringstream&& __rhs)
+ {
+ __iostream_type::operator=(std::move(__rhs));
+ _M_stringbuf = std::move(__rhs._M_stringbuf);
+ return *this;
+ }
+
+ void
+ swap(basic_stringstream& __rhs)
+ {
+ __iostream_type::swap(__rhs);
+ _M_stringbuf.swap(__rhs._M_stringbuf);
+ }
+#endif
+
// Members:
/**
* @brief Accessing the underlying buffer.
{ _M_stringbuf.str(__s); }
};
+#if __cplusplus >= 201103L
+ /// Swap specialization for stringbufs.
+ template <class _CharT, class _Traits, class _Allocator>
+ inline void
+ swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
+ basic_stringbuf<_CharT, _Traits, _Allocator>& __y)
+ { __x.swap(__y); }
+
+ /// Swap specialization for istringstreams.
+ template <class _CharT, class _Traits, class _Allocator>
+ inline void
+ swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
+ basic_istringstream<_CharT, _Traits, _Allocator>& __y)
+ { __x.swap(__y); }
+
+ /// Swap specialization for ostringstreams.
+ template <class _CharT, class _Traits, class _Allocator>
+ inline void
+ swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
+ basic_ostringstream<_CharT, _Traits, _Allocator>& __y)
+ { __x.swap(__y); }
+
+ /// Swap specialization for stringstreams.
+ template <class _CharT, class _Traits, class _Allocator>
+ inline void
+ swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
+ basic_stringstream<_CharT, _Traits, _Allocator>& __y)
+ { __x.swap(__y); }
+#endif
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#if __cplusplus < 201103L
private:
- // _GLIBCXX_RESOLVE_LIB_DEFECTS
- // Side effect of DR 50.
- basic_streambuf(const basic_streambuf& __sb)
- : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur),
- _M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg),
- _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_end),
- _M_buf_locale(__sb._M_buf_locale)
- { }
-
- basic_streambuf&
- operator=(const basic_streambuf&) { return *this; }
#else
protected:
- basic_streambuf(const basic_streambuf&) = default;
+#endif
+ basic_streambuf(const basic_streambuf&);
basic_streambuf&
- operator=(const basic_streambuf&) = default;
+ operator=(const basic_streambuf&);
+#if __cplusplus >= 201103L
void
swap(basic_streambuf& __sb)
{
#endif
};
+#if __cplusplus >= 201103L
+ template<typename _CharT, typename _Traits>
+ std::basic_streambuf<_CharT, _Traits>::
+ basic_streambuf(const basic_streambuf&) = default;
+
+ template<typename _CharT, typename _Traits>
+ std::basic_streambuf<_CharT, _Traits>&
+ std::basic_streambuf<_CharT, _Traits>::
+ operator=(const basic_streambuf&) = default;
+#endif
+
// Explicit specialization declarations, defined in src/streambuf.cc.
template<>
streamsize
template <typename _Tp, typename _Up = _Tp>
inline _Tp
exchange(_Tp& __obj, _Up&& __new_val)
- {
- _Tp __old_val = std::move(__obj);
- __obj = std::forward<_Up>(__new_val);
- return __old_val;
- }
+ { return std::__exchange(__obj, std::forward<_Up>(__new_val)); }
#endif
// Stores a tuple of indices. Used by tuple and pair, and by bind() to
future.cc \
hash_c++0x.cc \
hashtable_c++0x.cc \
+ ios.cc \
limits.cc \
mutex.cc \
placeholders.cc \
if ENABLE_EXTERN_TEMPLATE
# XTEMPLATE_FLAGS = -fno-implicit-templates
inst_sources = \
+ ext11-inst.cc \
fstream-inst.cc \
+ ios-inst.cc \
+ iostream-inst.cc \
+ istream-inst.cc \
+ ostream-inst.cc \
+ sstream-inst.cc \
+ streambuf-inst.cc \
string-inst.cc \
wstring-inst.cc
else
libc__11convenience_la_LIBADD =
am__objects_1 = chrono.lo condition_variable.lo debug.lo \
functexcept.lo functional.lo future.lo hash_c++0x.lo \
- hashtable_c++0x.lo limits.lo mutex.lo placeholders.lo \
+ hashtable_c++0x.lo ios.lo limits.lo mutex.lo placeholders.lo \
random.lo regex.lo shared_ptr.lo snprintf_lite.lo \
system_error.lo thread.lo
-@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_2 = fstream-inst.lo \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ string-inst.lo wstring-inst.lo
+@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_2 = ext11-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ fstream-inst.lo ios-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ iostream-inst.lo istream-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ostream-inst.lo sstream-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ streambuf-inst.lo string-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ wstring-inst.lo
am_libc__11convenience_la_OBJECTS = $(am__objects_1) $(am__objects_2)
libc__11convenience_la_OBJECTS = $(am_libc__11convenience_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
future.cc \
hash_c++0x.cc \
hashtable_c++0x.cc \
+ ios.cc \
limits.cc \
mutex.cc \
placeholders.cc \
# XTEMPLATE_FLAGS = -fno-implicit-templates
@ENABLE_EXTERN_TEMPLATE_TRUE@inst_sources = \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ext11-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ fstream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ios-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ iostream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ istream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ ostream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ sstream-inst.cc \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ streambuf-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ string-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ wstring-inst.cc
--- /dev/null
+// Explicit instantiation file.
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <ext/stdio_filebuf.h>
+#include <ext/stdio_sync_filebuf.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template class stdio_filebuf<char>;
+ template class stdio_sync_filebuf<char>;
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template class stdio_filebuf<wchar_t>;
+ template class stdio_sync_filebuf<wchar_t>;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+// Explicit instantiation file.
+
+// Copyright (C) 1997-2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <ios>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template class basic_ios<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template class basic_ios<wchar_t>;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+// Iostreams base classes -*- C++ -*-
+
+// Copyright (C) 1997-2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 27.4 Iostreams base classes
+//
+
+#include <ios>
+#include <limits>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // Definitions for static const members of ios_base.
+ const ios_base::fmtflags ios_base::boolalpha;
+ const ios_base::fmtflags ios_base::dec;
+ const ios_base::fmtflags ios_base::fixed;
+ const ios_base::fmtflags ios_base::hex;
+ const ios_base::fmtflags ios_base::internal;
+ const ios_base::fmtflags ios_base::left;
+ const ios_base::fmtflags ios_base::oct;
+ const ios_base::fmtflags ios_base::right;
+ const ios_base::fmtflags ios_base::scientific;
+ const ios_base::fmtflags ios_base::showbase;
+ const ios_base::fmtflags ios_base::showpoint;
+ const ios_base::fmtflags ios_base::showpos;
+ const ios_base::fmtflags ios_base::skipws;
+ const ios_base::fmtflags ios_base::unitbuf;
+ const ios_base::fmtflags ios_base::uppercase;
+ const ios_base::fmtflags ios_base::adjustfield;
+ const ios_base::fmtflags ios_base::basefield;
+ const ios_base::fmtflags ios_base::floatfield;
+
+ const ios_base::iostate ios_base::badbit;
+ const ios_base::iostate ios_base::eofbit;
+ const ios_base::iostate ios_base::failbit;
+ const ios_base::iostate ios_base::goodbit;
+
+ const ios_base::openmode ios_base::app;
+ const ios_base::openmode ios_base::ate;
+ const ios_base::openmode ios_base::binary;
+ const ios_base::openmode ios_base::in;
+ const ios_base::openmode ios_base::out;
+ const ios_base::openmode ios_base::trunc;
+
+ const ios_base::seekdir ios_base::beg;
+ const ios_base::seekdir ios_base::cur;
+ const ios_base::seekdir ios_base::end;
+
+ _Atomic_word ios_base::Init::_S_refcount;
+
+ bool ios_base::Init::_S_synced_with_stdio = true;
+
+ ios_base::ios_base() throw()
+ : _M_precision(), _M_width(), _M_flags(), _M_exception(),
+ _M_streambuf_state(), _M_callbacks(0), _M_word_zero(),
+ _M_word_size(_S_local_word_size), _M_word(_M_local_word), _M_ios_locale()
+ {
+ // Do nothing: basic_ios::init() does it.
+ // NB: _M_callbacks and _M_word must be zero for non-initialized
+ // ios_base to go through ~ios_base gracefully.
+ }
+
+ // 27.4.2.7 ios_base constructors/destructors
+ ios_base::~ios_base()
+ {
+ _M_call_callbacks(erase_event);
+ _M_dispose_callbacks();
+ if (_M_word != _M_local_word)
+ {
+ delete [] _M_word;
+ _M_word = 0;
+ }
+ }
+
+ // 27.4.2.5 ios_base storage functions
+ int
+ ios_base::xalloc() throw()
+ {
+ // Implementation note: Initialize top to zero to ensure that
+ // initialization occurs before main() is started.
+ static _Atomic_word _S_top = 0;
+ return __gnu_cxx::__exchange_and_add_dispatch(&_S_top, 1) + 4;
+ }
+
+ void
+ ios_base::register_callback(event_callback __fn, int __index)
+ { _M_callbacks = new _Callback_list(__fn, __index, _M_callbacks); }
+
+ // 27.4.2.5 iword/pword storage
+ ios_base::_Words&
+ ios_base::_M_grow_words(int __ix, bool __iword)
+ {
+ // Precondition: _M_word_size <= __ix
+ int __newsize = _S_local_word_size;
+ _Words* __words = _M_local_word;
+ if (__ix > _S_local_word_size - 1)
+ {
+ if (__ix < numeric_limits<int>::max())
+ {
+ __newsize = __ix + 1;
+ __try
+ { __words = new _Words[__newsize]; }
+ __catch(const std::bad_alloc&)
+ {
+ _M_streambuf_state |= badbit;
+ if (_M_streambuf_state & _M_exception)
+ __throw_ios_failure(__N("ios_base::_M_grow_words "
+ "allocation failed"));
+ if (__iword)
+ _M_word_zero._M_iword = 0;
+ else
+ _M_word_zero._M_pword = 0;
+ return _M_word_zero;
+ }
+ for (int __i = 0; __i < _M_word_size; __i++)
+ __words[__i] = _M_word[__i];
+ if (_M_word && _M_word != _M_local_word)
+ {
+ delete [] _M_word;
+ _M_word = 0;
+ }
+ }
+ else
+ {
+ _M_streambuf_state |= badbit;
+ if (_M_streambuf_state & _M_exception)
+ __throw_ios_failure(__N("ios_base::_M_grow_words is not valid"));
+ if (__iword)
+ _M_word_zero._M_iword = 0;
+ else
+ _M_word_zero._M_pword = 0;
+ return _M_word_zero;
+ }
+ }
+ _M_word = __words;
+ _M_word_size = __newsize;
+ return _M_word[__ix];
+ }
+
+ void
+ ios_base::_M_call_callbacks(event __e) throw()
+ {
+ _Callback_list* __p = _M_callbacks;
+ while (__p)
+ {
+ __try
+ { (*__p->_M_fn) (__e, *this, __p->_M_index); }
+ __catch(...)
+ { }
+ __p = __p->_M_next;
+ }
+ }
+
+ void
+ ios_base::_M_dispose_callbacks(void) throw()
+ {
+ _Callback_list* __p = _M_callbacks;
+ while (__p && __p->_M_remove_reference() == 0)
+ {
+ _Callback_list* __next = __p->_M_next;
+ delete __p;
+ __p = __next;
+ }
+ _M_callbacks = 0;
+ }
+
+ void
+ ios_base::_M_move(ios_base& __rhs) noexcept
+ {
+ _M_precision = __rhs._M_precision;
+ _M_width = __rhs._M_width;
+ _M_flags = __rhs._M_flags;
+ _M_exception = __rhs._M_exception;
+ _M_streambuf_state = __rhs._M_streambuf_state;
+ _M_callbacks = std::__exchange(__rhs._M_callbacks, nullptr);
+ if (_M_word != _M_local_word)
+ delete[] _M_word;
+ if (__rhs._M_word == __rhs._M_local_word)
+ {
+ _M_word = _M_local_word;
+ _M_word_size = _S_local_word_size;
+ for (int __i = 0; __i < _S_local_word_size; __i++)
+ _M_word[__i] = std::__exchange(__rhs._M_word[__i], {});
+ }
+ else
+ {
+ _M_word = std::__exchange(__rhs._M_word, __rhs._M_local_word);
+ _M_word_size
+ = std::__exchange(__rhs._M_word_size, _S_local_word_size);
+ }
+ _M_ios_locale = __rhs._M_ios_locale;
+ }
+
+ void
+ ios_base::_M_swap(ios_base& __rhs) noexcept
+ {
+ std::swap(_M_precision, __rhs._M_precision);
+ std::swap(_M_width, __rhs._M_width);
+ std::swap(_M_flags, __rhs._M_flags);
+ std::swap(_M_exception, __rhs._M_exception);
+ std::swap(_M_streambuf_state, __rhs._M_streambuf_state);
+ std::swap(_M_callbacks, __rhs._M_callbacks);
+ const bool __lhs_local = _M_word == _M_local_word;
+ const bool __rhs_local = __rhs._M_word == __rhs._M_local_word;
+ if (__lhs_local && __rhs_local)
+ std::swap(_M_local_word, __rhs._M_local_word); // array swap
+ else
+ {
+ if (!__lhs_local && !__lhs_local)
+ std::swap(_M_word, __rhs._M_word);
+ else
+ {
+ ios_base* __local;
+ ios_base* __allocated;
+ if (__lhs_local)
+ {
+ __local = this;
+ __allocated = &__rhs;
+ }
+ else
+ {
+ __local = &__rhs;
+ __allocated= this;
+ }
+ for (int __i = 0; __i < _S_local_word_size; __i++)
+ __allocated->_M_local_word[__i] = __local->_M_local_word[__i];
+ __local->_M_word = __allocated->_M_word;
+ __allocated->_M_word = __allocated->_M_local_word;
+ }
+ std::swap(_M_word_size, __rhs._M_word_size);
+ }
+ std::swap(_M_ios_locale, __rhs._M_ios_locale);
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+// Explicit instantiation file.
+
+// Copyright (C) 1997-2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <iomanip>
+#include <istream>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template class _Setfill<char>;
+ template _Setfill<char> setfill(char);
+ template class basic_iostream<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template class _Setfill<wchar_t>;
+ template _Setfill<wchar_t> setfill(wchar_t);
+ template class basic_iostream<wchar_t>;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+// Explicit instantiation file.
+
+// Copyright (C) 1997-2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <istream>
+#include <iomanip>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template class basic_istream<char>;
+ template istream& ws(istream&);
+ template istream& operator>>(istream&, char&);
+ template istream& operator>>(istream&, unsigned char&);
+ template istream& operator>>(istream&, signed char&);
+ template istream& operator>>(istream&, char*);
+ template istream& operator>>(istream&, unsigned char*);
+ template istream& operator>>(istream&, signed char*);
+
+ template istream& operator>>(istream&, _Setfill<char>);
+ template istream& operator>>(istream&, _Setiosflags);
+ template istream& operator>>(istream&, _Resetiosflags);
+ template istream& operator>>(istream&, _Setbase);
+ template istream& operator>>(istream&, _Setprecision);
+ template istream& operator>>(istream&, _Setw);
+
+ template istream& istream::_M_extract(unsigned short&);
+ template istream& istream::_M_extract(unsigned int&);
+ template istream& istream::_M_extract(long&);
+ template istream& istream::_M_extract(unsigned long&);
+ template istream& istream::_M_extract(bool&);
+#ifdef _GLIBCXX_USE_LONG_LONG
+ template istream& istream::_M_extract(long long&);
+ template istream& istream::_M_extract(unsigned long long&);
+#endif
+ template istream& istream::_M_extract(float&);
+ template istream& istream::_M_extract(double&);
+ template istream& istream::_M_extract(long double&);
+ template istream& istream::_M_extract(void*&);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template class basic_istream<wchar_t>;
+ template wistream& ws(wistream&);
+ template wistream& operator>>(wistream&, wchar_t&);
+ template wistream& operator>>(wistream&, wchar_t*);
+
+ template wistream& operator>>(wistream&, _Setfill<wchar_t>);
+ template wistream& operator>>(wistream&, _Setiosflags);
+ template wistream& operator>>(wistream&, _Resetiosflags);
+ template wistream& operator>>(wistream&, _Setbase);
+ template wistream& operator>>(wistream&, _Setprecision);
+ template wistream& operator>>(wistream&, _Setw);
+
+ template wistream& wistream::_M_extract(unsigned short&);
+ template wistream& wistream::_M_extract(unsigned int&);
+ template wistream& wistream::_M_extract(long&);
+ template wistream& wistream::_M_extract(unsigned long&);
+ template wistream& wistream::_M_extract(bool&);
+#ifdef _GLIBCXX_USE_LONG_LONG
+ template wistream& wistream::_M_extract(long long&);
+ template wistream& wistream::_M_extract(unsigned long long&);
+#endif
+ template wistream& wistream::_M_extract(float&);
+ template wistream& wistream::_M_extract(double&);
+ template wistream& wistream::_M_extract(long double&);
+ template wistream& wistream::_M_extract(void*&);
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+// XXX GLIBCXX_ABI Deprecated
+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
+
+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
+_GLIBCXX_LDBL_COMPAT (_ZNSirsERd, _ZNSirsERe);
+#ifdef _GLIBCXX_USE_WCHAR_T
+_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEErsERd,
+ _ZNSt13basic_istreamIwSt11char_traitsIwEErsERe);
+#endif
+_GLIBCXX_LDBL_COMPAT (_ZNSi10_M_extractIdEERSiRT_,
+ _ZNSi10_M_extractIeEERSiRT_);
+#ifdef _GLIBCXX_USE_WCHAR_T
+_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIdEERS2_RT_,
+ _ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIeEERS2_RT_);
+#endif
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- /dev/null
+// Explicit instantiation file.
+
+// Copyright (C) 1997-2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <ostream>
+#include <iomanip>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // ostream
+ template class basic_ostream<char>;
+ template ostream& endl(ostream&);
+ template ostream& ends(ostream&);
+ template ostream& flush(ostream&);
+ template ostream& operator<<(ostream&, char);
+ template ostream& operator<<(ostream&, unsigned char);
+ template ostream& operator<<(ostream&, signed char);
+ template ostream& operator<<(ostream&, const char*);
+ template ostream& operator<<(ostream&, const unsigned char*);
+ template ostream& operator<<(ostream&, const signed char*);
+
+ template ostream& operator<<(ostream&, _Setfill<char>);
+ template ostream& operator<<(ostream&, _Setiosflags);
+ template ostream& operator<<(ostream&, _Resetiosflags);
+ template ostream& operator<<(ostream&, _Setbase);
+ template ostream& operator<<(ostream&, _Setprecision);
+ template ostream& operator<<(ostream&, _Setw);
+ template ostream& __ostream_insert(ostream&, const char*, streamsize);
+
+ template ostream& ostream::_M_insert(long);
+ template ostream& ostream::_M_insert(unsigned long);
+ template ostream& ostream::_M_insert(bool);
+#ifdef _GLIBCXX_USE_LONG_LONG
+ template ostream& ostream::_M_insert(long long);
+ template ostream& ostream::_M_insert(unsigned long long);
+#endif
+ template ostream& ostream::_M_insert(double);
+ template ostream& ostream::_M_insert(long double);
+ template ostream& ostream::_M_insert(const void*);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template class basic_ostream<wchar_t>;
+ template wostream& endl(wostream&);
+ template wostream& ends(wostream&);
+ template wostream& flush(wostream&);
+ template wostream& operator<<(wostream&, wchar_t);
+ template wostream& operator<<(wostream&, char);
+ template wostream& operator<<(wostream&, const wchar_t*);
+ template wostream& operator<<(wostream&, const char*);
+
+ template wostream& operator<<(wostream&, _Setfill<wchar_t>);
+ template wostream& operator<<(wostream&, _Setiosflags);
+ template wostream& operator<<(wostream&, _Resetiosflags);
+ template wostream& operator<<(wostream&, _Setbase);
+ template wostream& operator<<(wostream&, _Setprecision);
+ template wostream& operator<<(wostream&, _Setw);
+ template wostream& __ostream_insert(wostream&, const wchar_t*, streamsize);
+
+ template wostream& wostream::_M_insert(long);
+ template wostream& wostream::_M_insert(unsigned long);
+ template wostream& wostream::_M_insert(bool);
+#ifdef _GLIBCXX_USE_LONG_LONG
+ template wostream& wostream::_M_insert(long long);
+ template wostream& wostream::_M_insert(unsigned long long);
+#endif
+ template wostream& wostream::_M_insert(double);
+ template wostream& wostream::_M_insert(long double);
+ template wostream& wostream::_M_insert(const void*);
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
+// XXX GLIBCXX_ABI Deprecated
+#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
+
+#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
+ extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
+_GLIBCXX_LDBL_COMPAT (_ZNSolsEd, _ZNSolsEe);
+#ifdef _GLIBCXX_USE_WCHAR_T
+_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEd,
+ _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEe);
+#endif
+_GLIBCXX_LDBL_COMPAT (_ZNSo9_M_insertIdEERSoT_,
+ _ZNSo9_M_insertIeEERSoT_);
+#ifdef _GLIBCXX_USE_WCHAR_T
+_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIdEERS2_T_,
+ _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIeEERS2_T_);
+#endif
+
+#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
--- /dev/null
+// Explicit instantiation file.
+
+// Copyright (C) 1997-2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <sstream>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template class basic_stringbuf<char>;
+ template class basic_istringstream<char>;
+ template class basic_ostringstream<char>;
+ template class basic_stringstream<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ template class basic_stringbuf<wchar_t>;
+ template class basic_istringstream<wchar_t>;
+ template class basic_ostringstream<wchar_t>;
+ template class basic_stringstream<wchar_t>;
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
--- /dev/null
+// Explicit instantiation file.
+
+// Copyright (C) 1997-2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:
+//
+
+#include <ios>
+#include <streambuf>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // streambuf
+ template class basic_streambuf<char>;
+
+ template
+ streamsize
+ __copy_streambufs(basic_streambuf<char>*, basic_streambuf<char>*);
+
+ template
+ streamsize
+ __copy_streambufs_eof(basic_streambuf<char>*,
+ basic_streambuf<char>*, bool&);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ // wstreambuf
+ template class basic_streambuf<wchar_t>;
+
+ template
+ streamsize
+ __copy_streambufs(basic_streambuf<wchar_t>*, basic_streambuf<wchar_t>*);
+
+ template
+ streamsize
+ __copy_streambufs_eof(basic_streambuf<wchar_t>*,
+ basic_streambuf<wchar_t>*, bool&);
+#endif
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
allocator-inst.cc \
concept-inst.cc \
ext-inst.cc \
- ios-inst.cc \
- iostream-inst.cc \
- istream-inst.cc \
locale-inst.cc \
misc-inst.cc \
- ostream-inst.cc \
- sstream-inst.cc \
- streambuf-inst.cc \
wlocale-inst.cc
else
# XTEMPLATE_FLAGS =
globals_io.cc \
hash_tr1.cc \
hashtable_tr1.cc \
- ios.cc \
ios_failure.cc \
ios_init.cc \
ios_locale.cc \
monetary_members.lo numeric_members.lo time_members.lo
@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_2 = allocator-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ concept-inst.lo ext-inst.lo \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ ios-inst.lo iostream-inst.lo \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ istream-inst.lo locale-inst.lo \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ misc-inst.lo ostream-inst.lo \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ sstream-inst.lo streambuf-inst.lo \
+@ENABLE_EXTERN_TEMPLATE_TRUE@ locale-inst.lo misc-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ wlocale-inst.lo
am__objects_3 = parallel_settings.lo
am__objects_4 = basic_file.lo c++locale.lo $(am__objects_2) \
$(am__objects_3)
am__objects_5 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
codecvt.lo complex_io.lo ctype.lo globals_io.lo hash_tr1.lo \
- hashtable_tr1.lo ios.lo ios_failure.lo ios_init.lo \
- ios_locale.lo list.lo list-aux.lo list-aux-2.lo \
- list_associated.lo list_associated-2.lo locale.lo \
- locale_init.lo locale_facets.lo localename.lo \
- math_stubs_float.lo math_stubs_long_double.lo stdexcept.lo \
- strstream.lo tree.lo istream.lo streambuf.lo valarray.lo \
- $(am__objects_1) $(am__objects_4)
+ hashtable_tr1.lo ios_failure.lo ios_init.lo ios_locale.lo \
+ list.lo list-aux.lo list-aux-2.lo list_associated.lo \
+ list_associated-2.lo locale.lo locale_init.lo locale_facets.lo \
+ localename.lo math_stubs_float.lo math_stubs_long_double.lo \
+ stdexcept.lo strstream.lo tree.lo istream.lo streambuf.lo \
+ valarray.lo $(am__objects_1) $(am__objects_4)
am_libc__98convenience_la_OBJECTS = $(am__objects_5)
libc__98convenience_la_OBJECTS = $(am_libc__98convenience_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
@ENABLE_EXTERN_TEMPLATE_TRUE@ allocator-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ concept-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ ext-inst.cc \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ ios-inst.cc \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ iostream-inst.cc \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ istream-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ locale-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ misc-inst.cc \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ ostream-inst.cc \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ sstream-inst.cc \
-@ENABLE_EXTERN_TEMPLATE_TRUE@ streambuf-inst.cc \
@ENABLE_EXTERN_TEMPLATE_TRUE@ wlocale-inst.cc
parallel_sources = parallel_settings.cc
globals_io.cc \
hash_tr1.cc \
hashtable_tr1.cc \
- ios.cc \
ios_failure.cc \
ios_init.cc \
ios_locale.cc \
//
#include <ext/rope>
-#include <ext/stdio_filebuf.h>
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
rope<char, std::allocator<char> >::
_S_fetch(_Rope_RopeRep<char, std::allocator<char> >*, size_type);
- template class stdio_filebuf<char>;
-
#ifdef _GLIBCXX_USE_WCHAR_T
template
const unsigned long
wchar_t
rope<wchar_t, std::allocator<wchar_t> >::
_S_fetch(_Rope_RopeRep<wchar_t, std::allocator<wchar_t> >*, size_type);
-
- template class stdio_filebuf<wchar_t>;
#endif
_GLIBCXX_END_NAMESPACE_VERSION
+++ /dev/null
-// Explicit instantiation file.
-
-// Copyright (C) 1997-2014 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-//
-// ISO C++ 14882:
-//
-
-#include <ios>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- template class basic_ios<char>;
-
-#ifdef _GLIBCXX_USE_WCHAR_T
- template class basic_ios<wchar_t>;
-#endif
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+++ /dev/null
-// Iostreams base classes -*- C++ -*-
-
-// Copyright (C) 1997-2014 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-//
-// ISO C++ 14882: 27.4 Iostreams base classes
-//
-
-#include <ios>
-#include <limits>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- // Definitions for static const members of ios_base.
- const ios_base::fmtflags ios_base::boolalpha;
- const ios_base::fmtflags ios_base::dec;
- const ios_base::fmtflags ios_base::fixed;
- const ios_base::fmtflags ios_base::hex;
- const ios_base::fmtflags ios_base::internal;
- const ios_base::fmtflags ios_base::left;
- const ios_base::fmtflags ios_base::oct;
- const ios_base::fmtflags ios_base::right;
- const ios_base::fmtflags ios_base::scientific;
- const ios_base::fmtflags ios_base::showbase;
- const ios_base::fmtflags ios_base::showpoint;
- const ios_base::fmtflags ios_base::showpos;
- const ios_base::fmtflags ios_base::skipws;
- const ios_base::fmtflags ios_base::unitbuf;
- const ios_base::fmtflags ios_base::uppercase;
- const ios_base::fmtflags ios_base::adjustfield;
- const ios_base::fmtflags ios_base::basefield;
- const ios_base::fmtflags ios_base::floatfield;
-
- const ios_base::iostate ios_base::badbit;
- const ios_base::iostate ios_base::eofbit;
- const ios_base::iostate ios_base::failbit;
- const ios_base::iostate ios_base::goodbit;
-
- const ios_base::openmode ios_base::app;
- const ios_base::openmode ios_base::ate;
- const ios_base::openmode ios_base::binary;
- const ios_base::openmode ios_base::in;
- const ios_base::openmode ios_base::out;
- const ios_base::openmode ios_base::trunc;
-
- const ios_base::seekdir ios_base::beg;
- const ios_base::seekdir ios_base::cur;
- const ios_base::seekdir ios_base::end;
-
- _Atomic_word ios_base::Init::_S_refcount;
-
- bool ios_base::Init::_S_synced_with_stdio = true;
-
- ios_base::ios_base() throw()
- : _M_precision(), _M_width(), _M_flags(), _M_exception(),
- _M_streambuf_state(), _M_callbacks(0), _M_word_zero(),
- _M_word_size(_S_local_word_size), _M_word(_M_local_word), _M_ios_locale()
- {
- // Do nothing: basic_ios::init() does it.
- // NB: _M_callbacks and _M_word must be zero for non-initialized
- // ios_base to go through ~ios_base gracefully.
- }
-
- // 27.4.2.7 ios_base constructors/destructors
- ios_base::~ios_base()
- {
- _M_call_callbacks(erase_event);
- _M_dispose_callbacks();
- if (_M_word != _M_local_word)
- {
- delete [] _M_word;
- _M_word = 0;
- }
- }
-
- // 27.4.2.5 ios_base storage functions
- int
- ios_base::xalloc() throw()
- {
- // Implementation note: Initialize top to zero to ensure that
- // initialization occurs before main() is started.
- static _Atomic_word _S_top = 0;
- return __gnu_cxx::__exchange_and_add_dispatch(&_S_top, 1) + 4;
- }
-
- void
- ios_base::register_callback(event_callback __fn, int __index)
- { _M_callbacks = new _Callback_list(__fn, __index, _M_callbacks); }
-
- // 27.4.2.5 iword/pword storage
- ios_base::_Words&
- ios_base::_M_grow_words(int __ix, bool __iword)
- {
- // Precondition: _M_word_size <= __ix
- int __newsize = _S_local_word_size;
- _Words* __words = _M_local_word;
- if (__ix > _S_local_word_size - 1)
- {
- if (__ix < numeric_limits<int>::max())
- {
- __newsize = __ix + 1;
- __try
- { __words = new _Words[__newsize]; }
- __catch(const std::bad_alloc&)
- {
- _M_streambuf_state |= badbit;
- if (_M_streambuf_state & _M_exception)
- __throw_ios_failure(__N("ios_base::_M_grow_words "
- "allocation failed"));
- if (__iword)
- _M_word_zero._M_iword = 0;
- else
- _M_word_zero._M_pword = 0;
- return _M_word_zero;
- }
- for (int __i = 0; __i < _M_word_size; __i++)
- __words[__i] = _M_word[__i];
- if (_M_word && _M_word != _M_local_word)
- {
- delete [] _M_word;
- _M_word = 0;
- }
- }
- else
- {
- _M_streambuf_state |= badbit;
- if (_M_streambuf_state & _M_exception)
- __throw_ios_failure(__N("ios_base::_M_grow_words is not valid"));
- if (__iword)
- _M_word_zero._M_iword = 0;
- else
- _M_word_zero._M_pword = 0;
- return _M_word_zero;
- }
- }
- _M_word = __words;
- _M_word_size = __newsize;
- return _M_word[__ix];
- }
-
- void
- ios_base::_M_call_callbacks(event __e) throw()
- {
- _Callback_list* __p = _M_callbacks;
- while (__p)
- {
- __try
- { (*__p->_M_fn) (__e, *this, __p->_M_index); }
- __catch(...)
- { }
- __p = __p->_M_next;
- }
- }
-
- void
- ios_base::_M_dispose_callbacks(void) throw()
- {
- _Callback_list* __p = _M_callbacks;
- while (__p && __p->_M_remove_reference() == 0)
- {
- _Callback_list* __next = __p->_M_next;
- delete __p;
- __p = __next;
- }
- _M_callbacks = 0;
- }
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+++ /dev/null
-// Explicit instantiation file.
-
-// Copyright (C) 1997-2014 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-//
-// ISO C++ 14882:
-//
-
-#include <iomanip>
-#include <istream>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- template class _Setfill<char>;
- template _Setfill<char> setfill(char);
- template class basic_iostream<char>;
-
-#ifdef _GLIBCXX_USE_WCHAR_T
- template class _Setfill<wchar_t>;
- template _Setfill<wchar_t> setfill(wchar_t);
- template class basic_iostream<wchar_t>;
-#endif
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+++ /dev/null
-// Explicit instantiation file.
-
-// Copyright (C) 1997-2014 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-//
-// ISO C++ 14882:
-//
-
-#include <istream>
-#include <iomanip>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- template class basic_istream<char>;
- template istream& ws(istream&);
- template istream& operator>>(istream&, char&);
- template istream& operator>>(istream&, unsigned char&);
- template istream& operator>>(istream&, signed char&);
- template istream& operator>>(istream&, char*);
- template istream& operator>>(istream&, unsigned char*);
- template istream& operator>>(istream&, signed char*);
-
- template istream& operator>>(istream&, _Setfill<char>);
- template istream& operator>>(istream&, _Setiosflags);
- template istream& operator>>(istream&, _Resetiosflags);
- template istream& operator>>(istream&, _Setbase);
- template istream& operator>>(istream&, _Setprecision);
- template istream& operator>>(istream&, _Setw);
-
- template istream& istream::_M_extract(unsigned short&);
- template istream& istream::_M_extract(unsigned int&);
- template istream& istream::_M_extract(long&);
- template istream& istream::_M_extract(unsigned long&);
- template istream& istream::_M_extract(bool&);
-#ifdef _GLIBCXX_USE_LONG_LONG
- template istream& istream::_M_extract(long long&);
- template istream& istream::_M_extract(unsigned long long&);
-#endif
- template istream& istream::_M_extract(float&);
- template istream& istream::_M_extract(double&);
- template istream& istream::_M_extract(long double&);
- template istream& istream::_M_extract(void*&);
-
-#ifdef _GLIBCXX_USE_WCHAR_T
- template class basic_istream<wchar_t>;
- template wistream& ws(wistream&);
- template wistream& operator>>(wistream&, wchar_t&);
- template wistream& operator>>(wistream&, wchar_t*);
-
- template wistream& operator>>(wistream&, _Setfill<wchar_t>);
- template wistream& operator>>(wistream&, _Setiosflags);
- template wistream& operator>>(wistream&, _Resetiosflags);
- template wistream& operator>>(wistream&, _Setbase);
- template wistream& operator>>(wistream&, _Setprecision);
- template wistream& operator>>(wistream&, _Setw);
-
- template wistream& wistream::_M_extract(unsigned short&);
- template wistream& wistream::_M_extract(unsigned int&);
- template wistream& wistream::_M_extract(long&);
- template wistream& wistream::_M_extract(unsigned long&);
- template wistream& wistream::_M_extract(bool&);
-#ifdef _GLIBCXX_USE_LONG_LONG
- template wistream& wistream::_M_extract(long long&);
- template wistream& wistream::_M_extract(unsigned long long&);
-#endif
- template wistream& wistream::_M_extract(float&);
- template wistream& wistream::_M_extract(double&);
- template wistream& wistream::_M_extract(long double&);
- template wistream& wistream::_M_extract(void*&);
-#endif
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
-
-// XXX GLIBCXX_ABI Deprecated
-#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
-
-#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
- extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
-_GLIBCXX_LDBL_COMPAT (_ZNSirsERd, _ZNSirsERe);
-#ifdef _GLIBCXX_USE_WCHAR_T
-_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEErsERd,
- _ZNSt13basic_istreamIwSt11char_traitsIwEErsERe);
-#endif
-_GLIBCXX_LDBL_COMPAT (_ZNSi10_M_extractIdEERSiRT_,
- _ZNSi10_M_extractIeEERSiRT_);
-#ifdef _GLIBCXX_USE_WCHAR_T
-_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIdEERS2_RT_,
- _ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIeEERS2_RT_);
-#endif
-
-#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
#include <string>
#include <istream>
#include <ostream>
-#include <ext/stdio_sync_filebuf.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-
-namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- template class stdio_sync_filebuf<char>;
-#ifdef _GLIBCXX_USE_WCHAR_T
- template class stdio_sync_filebuf<wchar_t>;
-#endif
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
-
-
+++ /dev/null
-// Explicit instantiation file.
-
-// Copyright (C) 1997-2014 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-//
-// ISO C++ 14882:
-//
-
-#include <ostream>
-#include <iomanip>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- // ostream
- template class basic_ostream<char>;
- template ostream& endl(ostream&);
- template ostream& ends(ostream&);
- template ostream& flush(ostream&);
- template ostream& operator<<(ostream&, char);
- template ostream& operator<<(ostream&, unsigned char);
- template ostream& operator<<(ostream&, signed char);
- template ostream& operator<<(ostream&, const char*);
- template ostream& operator<<(ostream&, const unsigned char*);
- template ostream& operator<<(ostream&, const signed char*);
-
- template ostream& operator<<(ostream&, _Setfill<char>);
- template ostream& operator<<(ostream&, _Setiosflags);
- template ostream& operator<<(ostream&, _Resetiosflags);
- template ostream& operator<<(ostream&, _Setbase);
- template ostream& operator<<(ostream&, _Setprecision);
- template ostream& operator<<(ostream&, _Setw);
- template ostream& __ostream_insert(ostream&, const char*, streamsize);
-
- template ostream& ostream::_M_insert(long);
- template ostream& ostream::_M_insert(unsigned long);
- template ostream& ostream::_M_insert(bool);
-#ifdef _GLIBCXX_USE_LONG_LONG
- template ostream& ostream::_M_insert(long long);
- template ostream& ostream::_M_insert(unsigned long long);
-#endif
- template ostream& ostream::_M_insert(double);
- template ostream& ostream::_M_insert(long double);
- template ostream& ostream::_M_insert(const void*);
-
-#ifdef _GLIBCXX_USE_WCHAR_T
- template class basic_ostream<wchar_t>;
- template wostream& endl(wostream&);
- template wostream& ends(wostream&);
- template wostream& flush(wostream&);
- template wostream& operator<<(wostream&, wchar_t);
- template wostream& operator<<(wostream&, char);
- template wostream& operator<<(wostream&, const wchar_t*);
- template wostream& operator<<(wostream&, const char*);
-
- template wostream& operator<<(wostream&, _Setfill<wchar_t>);
- template wostream& operator<<(wostream&, _Setiosflags);
- template wostream& operator<<(wostream&, _Resetiosflags);
- template wostream& operator<<(wostream&, _Setbase);
- template wostream& operator<<(wostream&, _Setprecision);
- template wostream& operator<<(wostream&, _Setw);
- template wostream& __ostream_insert(wostream&, const wchar_t*, streamsize);
-
- template wostream& wostream::_M_insert(long);
- template wostream& wostream::_M_insert(unsigned long);
- template wostream& wostream::_M_insert(bool);
-#ifdef _GLIBCXX_USE_LONG_LONG
- template wostream& wostream::_M_insert(long long);
- template wostream& wostream::_M_insert(unsigned long long);
-#endif
- template wostream& wostream::_M_insert(double);
- template wostream& wostream::_M_insert(long double);
- template wostream& wostream::_M_insert(const void*);
-#endif
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
-
-// XXX GLIBCXX_ABI Deprecated
-#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
-
-#define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
- extern "C" void ldbl (void) __attribute__ ((alias (#dbl), weak))
-_GLIBCXX_LDBL_COMPAT (_ZNSolsEd, _ZNSolsEe);
-#ifdef _GLIBCXX_USE_WCHAR_T
-_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEd,
- _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEe);
-#endif
-_GLIBCXX_LDBL_COMPAT (_ZNSo9_M_insertIdEERSoT_,
- _ZNSo9_M_insertIeEERSoT_);
-#ifdef _GLIBCXX_USE_WCHAR_T
-_GLIBCXX_LDBL_COMPAT (_ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIdEERS2_T_,
- _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIeEERS2_T_);
-#endif
-
-#endif // _GLIBCXX_LONG_DOUBLE_COMPAT
+++ /dev/null
-// Explicit instantiation file.
-
-// Copyright (C) 1997-2014 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-//
-// ISO C++ 14882:
-//
-
-#include <sstream>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- template class basic_stringbuf<char>;
- template class basic_istringstream<char>;
- template class basic_ostringstream<char>;
- template class basic_stringstream<char>;
-
-#ifdef _GLIBCXX_USE_WCHAR_T
- template class basic_stringbuf<wchar_t>;
- template class basic_istringstream<wchar_t>;
- template class basic_ostringstream<wchar_t>;
- template class basic_stringstream<wchar_t>;
-#endif
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
+++ /dev/null
-// Explicit instantiation file.
-
-// Copyright (C) 1997-2014 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// Under Section 7 of GPL version 3, you are granted additional
-// permissions described in the GCC Runtime Library Exception, version
-// 3.1, as published by the Free Software Foundation.
-
-// You should have received a copy of the GNU General Public License and
-// a copy of the GCC Runtime Library Exception along with this program;
-// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-// <http://www.gnu.org/licenses/>.
-
-//
-// ISO C++ 14882:
-//
-
-#include <ios>
-#include <streambuf>
-
-namespace std _GLIBCXX_VISIBILITY(default)
-{
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
- // streambuf
- template class basic_streambuf<char>;
-
- template
- streamsize
- __copy_streambufs(basic_streambuf<char>*, basic_streambuf<char>*);
-
- template
- streamsize
- __copy_streambufs_eof(basic_streambuf<char>*,
- basic_streambuf<char>*, bool&);
-
-#ifdef _GLIBCXX_USE_WCHAR_T
- // wstreambuf
- template class basic_streambuf<wchar_t>;
-
- template
- streamsize
- __copy_streambufs(basic_streambuf<wchar_t>*, basic_streambuf<wchar_t>*);
-
- template
- streamsize
- __copy_streambufs_eof(basic_streambuf<wchar_t>*,
- basic_streambuf<wchar_t>*, bool&);
-#endif
-
-_GLIBCXX_END_NAMESPACE_VERSION
-} // namespace
--- /dev/null
+// { dg-options "-std=gnu++11" }
+// { dg-do compile }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <fstream>
+
+void test()
+{
+ std::filebuf f;
+ std::filebuf ff(f); // { dg-error "deleted function" }
+ ff = f; // { dg-error "deleted function" }
+}
--- /dev/null
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-require-fileio "" }
+
+// 27.9.1.16 Assign and swap [fstream.assign]
+
+#include <fstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+string const name = "fstream-assign.txt";
+
+void
+test01()
+{
+ string orig = "Let the whole outside world consist of a long paper tape.";
+ {
+ fstream f(name, ios::in|ios::out|ios::trunc);
+ VERIFY( f.is_open() );
+ f << orig;
+ fstream f1;
+ f1 = std::move(f);
+ VERIFY( f1.is_open() );
+ VERIFY( !f.is_open() );
+ f1.seekg(0);
+ string result;
+ getline(f1, result);
+ VERIFY( result == orig );
+ }
+ {
+ fstream f(name, ios::in);
+ VERIFY( f.is_open() );
+ fstream f1;
+ f1.swap(f);
+ VERIFY( f1.is_open() );
+ VERIFY( !f.is_open() );
+ string result;
+ getline(f1, result);
+ VERIFY( result == orig );
+ }
+ {
+ fstream f(name, ios::in);
+ VERIFY( f.is_open() );
+ fstream f1;
+ swap(f1, f);
+ VERIFY( f1.is_open() );
+ VERIFY( !f.is_open() );
+ string result;
+ getline(f1, result);
+ VERIFY( result == orig );
+ }
+}
+
+void
+test02()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ wfstream f, f2;
+ f2 = std::move(f);
+ f2.swap(f);
+ swap(f2, f);
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
--- /dev/null
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-require-fileio "" }
+
+// 27.9.1.15 basic_fstream constructors [fstream.cons]
+
+#include <fstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+std::string const name = "fstream-move.txt";
+
+void
+test01()
+{
+ string orig = "Let the whole outside world consist of a long paper tape.";
+ fstream f(name, ios::in|ios::out|ios::trunc);
+ VERIFY( f.is_open() );
+ f << orig;
+ fstream f1 = std::move(f);
+ VERIFY( f1.is_open() );
+ VERIFY( !f.is_open() );
+ f1.seekg(0);
+ string result;
+ getline(f1, result);
+ VERIFY( result == orig );
+}
+
+void
+test02()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ wstring orig = L"Let the whole outside world consist of a long paper tape.";
+ wfstream f(name, ios::in|ios::out|ios::trunc);
+ VERIFY( f.is_open() );
+ f << orig;
+ wfstream f1 = std::move(f);
+ VERIFY( f1.is_open() );
+ VERIFY( !f.is_open() );
+ f1.seekg(0);
+ wstring result;
+ getline(f1, result);
+ VERIFY( result == orig );
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
--- /dev/null
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-require-fileio "" }
+
+// 27.9.1.8 Assign and swap [ifstream.assign]
+
+#include <fstream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+read(std::istream& in, std::ostream& out)
+{
+ std::string s;
+ for (int i=0; i < 10; ++i)
+ {
+ getline(in, s);
+ out << s << '\n';
+ }
+}
+
+void
+test01()
+{
+ std::string const name = "thirty_years_among_the_dead_preproc.txt";
+ std::ostringstream ss0;
+ {
+ std::ifstream f0(name);
+ read(f0, ss0);
+ }
+ {
+ std::ifstream f0(name);
+ std::ifstream f1;
+ f1 = std::move(f0);
+ VERIFY( !f0.is_open() );
+ VERIFY( f1.is_open() );
+ std::ostringstream ss1;
+ read(f1, ss1);
+ VERIFY( ss0.str() == ss1.str() );
+ }
+ {
+ std::ifstream f0(name);
+ std::ifstream f1;
+ f1.swap(f0);
+ VERIFY( !f0.is_open() );
+ VERIFY( f1.is_open() );
+ std::ostringstream ss1;
+ read(f1, ss1);
+ VERIFY( ss0.str() == ss1.str() );
+ }
+}
+
+void
+test02()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::wifstream f, f2;
+ f2 = std::move(f);
+ f2.swap(f);
+ swap(f2, f);
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
--- /dev/null
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-require-fileio "" }
+
+// 27.9.1.7 basic_ifstream constructors [ifstream.cons]
+
+#include <fstream>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+read(std::istream& in, std::ostream& out)
+{
+ std::string s;
+ for (int i=0; i < 10; ++i)
+ {
+ getline(in, s);
+ out << s << '\n';
+ }
+}
+
+void
+test01()
+{
+ std::string const name = "thirty_years_among_the_dead_preproc.txt";
+ std::ostringstream ss0;
+ {
+ std::ifstream f0(name);
+ read(f0, ss0);
+ }
+ std::ifstream f0(name);
+ std::ifstream f1 = std::move(f0);
+ VERIFY( !f0.is_open() );
+ VERIFY( f1.is_open() );
+ std::ostringstream ss1;
+ read(f1, ss1);
+ VERIFY( ss0.str() == ss1.str() );
+}
+
+void
+test02()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::wifstream f0("thirty_years_among_the_dead_preproc.txt");
+ std::wifstream f1 = std::move(f0);
+ VERIFY( f1.is_open() );
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
--- /dev/null
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.8.3.2 Assign and swap [istringstream.assign]
+
+#include <sstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::istringstream s1("absence of a signal");
+ std::string s;
+ s1 >> s;
+
+ std::istringstream s2;
+ s2 = std::move(s1);
+ s2 >> s;
+ VERIFY(s == "of");
+
+ std::istringstream s3;
+ s3.swap(s2);
+ s3 >> s;
+ VERIFY(s == "a");
+
+ swap(s1, s3);
+ s1 >> s;
+ VERIFY(s == "signal");
+
+ s2.str("should never be used as a signal");
+ s1 = std::move(s2);
+ getline(s1, s);
+ VERIFY(s == "should never be used as a signal");
+ s3 = std::move(s1);
+ VERIFY(s3.eof());
+}
+
+void test02()
+{
+ std::istringstream s0{ " 1234.5 " };
+ std::istringstream s;
+ s = std::move(s0);
+ char c{};
+ s >> c;
+ VERIFY( c == '1' );
+ int i{};
+ s >> i;
+ VERIFY( i == 234 );
+ double d{};
+ s >> d;
+ VERIFY( d == .5 );
+}
+
+void test03()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::wistringstream s0{ L" 1234.5 " };
+ std::wistringstream s;
+ s = std::move(s0);
+ s.swap(s0);
+ swap(s, s0);
+ wchar_t c{};
+ s >> c;
+ VERIFY( c == L'1' );
+ int i{};
+ s >> i;
+ VERIFY( i == 234 );
+ double d{};
+ s >> d;
+ VERIFY( d == .5 );
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+}
--- /dev/null
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.8.3.1 basic_istringstream constructors [istringstream.cons]
+
+#include <sstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::istringstream s1("absence of a signal");
+ std::string s;
+ s1 >> s;
+
+ std::istringstream s2 = std::move(s1);
+ s2 >> s;
+ VERIFY(s == "of");
+
+ std::istringstream s3;
+ s3 = std::move(s2);
+ s3 >> s;
+ VERIFY(s == "a");
+
+ s1 = std::move(s3);
+ s1 >> s;
+ VERIFY(s == "signal");
+
+ s2.str("should never be used as a signal");
+ s1 = std::move(s2);
+ getline(s1, s);
+ VERIFY(s == "should never be used as a signal");
+ s3 = std::move(s1);
+ VERIFY(s3.eof());
+}
+
+void
+test02()
+{
+ std::istringstream s0{ " 1234.5 " };
+ std::istringstream s{ std::move(s0) };
+ char c{};
+ s >> c;
+ VERIFY( c == '1' );
+ int i{};
+ s >> i;
+ VERIFY( i == 234 );
+ double d{};
+ s >> d;
+ VERIFY( d == .5 );
+}
+
+void
+test03()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::wistringstream s0{ L" 1234.5 " };
+ std::wistringstream s{ std::move(s0) };
+ wchar_t c{};
+ s >> c;
+ VERIFY( c == L'1' );
+ int i{};
+ s >> i;
+ VERIFY( i == 234 );
+ double d{};
+ s >> d;
+ VERIFY( d == .5 );
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+}
--- /dev/null
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-require-fileio "" }
+
+// 27.9.1.12 Assign and swap [ostringstream.assign]
+
+#include <fstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+string const name = "ofstream-assign.txt";
+
+void
+test01()
+{
+ string s1 = "Let the whole outside world";
+ string s2 = " consist of a long paper tape.";
+ ofstream f(name, ios::trunc);
+ VERIFY( f.is_open() );
+ f << s1;
+ {
+ ofstream f1;
+ f1 = std::move(f);
+ VERIFY( f1.is_open() );
+ VERIFY( !f.is_open() );
+ f1 << s2;
+ f1.swap(f);
+ VERIFY( !f1.is_open() );
+ VERIFY( f.is_open() );
+ f << s1;
+ swap(f1, f);
+ f1 << s2;
+ }
+ ifstream in(name);
+ string result;
+ getline(in, result);
+ VERIFY( result == (s1 + s2 + s1 + s2) );
+}
+
+void
+test02()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::wofstream s0, s;
+ s = std::move(s0);
+ s.swap(s0);
+ swap(s, s0);
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
--- /dev/null
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++11" }
+// { dg-require-fileio "" }
+
+// 27.9.1.11 basic_ofstream constructors [ofstream.cons]
+
+#include <fstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+std::string const name = "ofstream-move.txt";
+
+void
+test01()
+{
+ string s1 = "Let the whole outside world";
+ string s2 = " consist of a long paper tape.";
+ ofstream f(name, ios::trunc);
+ VERIFY( f.is_open() );
+ f << s1;
+ {
+ ofstream f1 = std::move(f);
+ VERIFY( f1.is_open() );
+ VERIFY( !f.is_open() );
+ f1 << s2;
+ }
+ ifstream in(name);
+ string result;
+ getline(in, result);
+ VERIFY( result == (s1 + s2) );
+}
+
+void
+test02()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ wstring s1 = L"Let the whole outside world";
+ wstring s2 = L" consist of a long paper tape.";
+ wofstream f(name, ios::trunc);
+ VERIFY( f.is_open() );
+ f << s1;
+ {
+ wofstream f1 = std::move(f);
+ VERIFY( f1.is_open() );
+ VERIFY( !f.is_open() );
+ f1 << s2;
+ }
+ wifstream in(name);
+ wstring result;
+ getline(in, result);
+ VERIFY( result == (s1 + s2) );
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
--- /dev/null
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.8.4.2 Assign and swap [ostringstream.assign]
+
+#include <sstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+const std::string strings[] = {
+ "one could carry out the description of a machine, ",
+ "no matter how complicated, ",
+ "in characters which would be merely the letters of the alphabet, and so ",
+ "provide the mind with a method of knowing the machine and all its parts"
+};
+
+void
+append(std::ostringstream& ss, std::string& s, const std::string& t)
+{
+ ss << t;
+ s += t;
+}
+
+// assign
+void
+test01()
+{
+ std::string exp;
+ std::ostringstream s1;
+ append(s1, exp, strings[0]);
+
+ std::ostringstream s2;
+ s2 = std::move(s1);
+ VERIFY( s2.str() == exp );
+ append(s2, exp, strings[1]);
+ VERIFY( s2.str() == exp );
+
+ std::ostringstream s3;
+ s3 = std::move(s2);
+ VERIFY( s3.str() == exp );
+ append(s3, exp, strings[2]);
+ VERIFY( s3.str() == exp );
+
+ s1.setstate(std::ios::failbit);
+ s1 = std::move(s3);
+ VERIFY( s1.good() );
+ VERIFY( s1.str() == exp );
+ append(s1, exp, strings[3]);
+ VERIFY( s1.str() == exp );
+}
+
+// swap
+void
+test02()
+{
+ std::string exp;
+ std::ostringstream s1;
+ append(s1, exp, strings[0]);
+
+ std::ostringstream s2;
+ s2.swap(s1);
+ VERIFY( s1.str().empty() );
+ VERIFY( s2.str() == exp );
+ append(s2, exp, strings[1]);
+ VERIFY( s2.str() == exp );
+
+ std::ostringstream s3;
+ swap(s3, s2);
+ VERIFY( s2.str().empty() );
+ VERIFY( s3.str() == exp );
+ append(s3, exp, strings[2]);
+ VERIFY( s3.str() == exp );
+
+ s1.setstate(std::ios::failbit);
+ swap(s1, s3);
+ VERIFY( s1.good() );
+ VERIFY( s3.fail() );
+ VERIFY( s2.str().empty() );
+ VERIFY( s1.str() == exp );
+ append(s1, exp, strings[3]);
+ VERIFY( s1.str() == exp );
+}
+
+void
+test03()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::wistringstream s0, s;
+ s = std::move(s0);
+ s.swap(s0);
+ swap(s, s0);
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+}
--- /dev/null
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.8.4.1 basic_ostringstream constructors [ostringstream.cons]
+
+#include <sstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+const std::string strings[] = {
+ "one could carry out the description of a machine, ",
+ "no matter how complicated, ",
+ "in characters which would be merely the letters of the alphabet, and so ",
+ "provide the mind with a method of knowing the machine and all its parts"
+};
+
+void
+append(std::ostringstream& ss, std::string& s, const std::string& t)
+{
+ ss << t;
+ s += t;
+}
+
+void
+test01()
+{
+ std::string exp;
+ std::ostringstream s1;
+ append(s1, exp, strings[0]);
+
+ std::ostringstream s2 = std::move(s1);
+ VERIFY( s2.good() );
+ VERIFY( s2.rdbuf() != nullptr );
+ VERIFY( s2.str() == exp );
+ append(s2, exp, strings[1]);
+ VERIFY( s2.str() == exp );
+
+ std::ostringstream s3 = std::move(s2);
+ VERIFY( s3.good() );
+ VERIFY( s3.rdbuf() != nullptr );
+ VERIFY( s3.str() == exp );
+ append(s3, exp, strings[2]);
+ VERIFY( s3.str() == exp );
+
+ s1.str("");
+ s1.clear();
+ exp.clear();
+ append(s1, exp, strings[3]);
+ VERIFY( s1.str() == exp );
+}
+
+void
+test02()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::wostringstream s1;
+ std::wostringstream s2 = std::move(s1);
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
--- /dev/null
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.8.5.2 Assign and swap [stringstream.assign]
+
+#include <sstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::stringstream s1;
+ s1 << "absence of a signal";
+ std::string s;
+ s1 >> s;
+
+ std::stringstream s2;
+ s2 = std::move(s1);
+ s2 >> s;
+ VERIFY(s == "of");
+
+ std::stringstream s3;
+ s3.swap(s2);
+ s3 >> s;
+ VERIFY(s == "a");
+
+ swap(s1, s3);
+ s1 >> s;
+ VERIFY(s == "signal");
+
+ s2 << "should never be used as a signal";
+ s1 = std::move(s2);
+ getline(s1, s);
+ VERIFY(s == "should never be used as a signal");
+ s3 = std::move(s1);
+ VERIFY(s3.eof());
+}
+
+void test02()
+{
+ std::stringstream s0;
+ s0 << " 1234.5 ";
+ std::stringstream s;
+ s = std::move(s0);
+ char c{};
+ s >> c;
+ VERIFY( c == '1' );
+ int i{};
+ s >> i;
+ VERIFY( i == 234 );
+ double d{};
+ s >> d;
+ VERIFY( d == .5 );
+}
+
+void test03()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::wstringstream s0;
+ s0 << L" 1234.5 ";
+ std::wstringstream s;
+ s = std::move(s0);
+ s.swap(s0);
+ swap(s, s0);
+ wchar_t c{};
+ s >> c;
+ VERIFY( c == L'1' );
+ int i{};
+ s >> i;
+ VERIFY( i == 234 );
+ double d{};
+ s >> d;
+ VERIFY( d == .5 );
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+}
--- /dev/null
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2014 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.8.5.1 basic_stringstream constructors [stringstream.cons]
+
+#include <sstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+const std::string strings[] = {
+ "one could carry out the description of a machine, ",
+ "no matter how complicated, ",
+ "in characters which would be merely the letters of the alphabet, and so ",
+ "provide the mind with a method of knowing the machine and all its parts"
+};
+
+void
+append(std::stringstream& ss, std::string& s, const std::string& t)
+{
+ ss << t;
+ s += t;
+}
+
+void
+test01()
+{
+ std::string exp;
+ std::stringstream s1;
+ append(s1, exp, strings[0]);
+
+ std::stringstream s2 = std::move(s1);
+ VERIFY( s2.good() );
+ VERIFY( s2.rdbuf() != nullptr );
+ VERIFY( s2.str() == exp );
+ append(s2, exp, strings[1]);
+ VERIFY( s2.str() == exp );
+
+ std::stringstream s3 = std::move(s2);
+ VERIFY( s3.good() );
+ VERIFY( s3.rdbuf() != nullptr );
+ VERIFY( s3.str() == exp );
+ append(s3, exp, strings[2]);
+ VERIFY( s3.str() == exp );
+
+ s1.str("");
+ s1.clear();
+ exp.clear();
+ append(s1, exp, strings[3]);
+ VERIFY( s1.str() == exp );
+}
+
+void
+test02()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::wstringstream s1;
+ std::wstringstream s2 = std::move(s1);
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}