aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/include/std/iosfwd18
-rw-r--r--libstdc++-v3/include/std/syncstream6
-rw-r--r--libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc119
-rw-r--r--libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc214
4 files changed, 353 insertions, 4 deletions
diff --git a/libstdc++-v3/include/std/iosfwd b/libstdc++-v3/include/std/iosfwd
index 2d79a13..c8c67c8 100644
--- a/libstdc++-v3/include/std/iosfwd
+++ b/libstdc++-v3/include/std/iosfwd
@@ -207,6 +207,24 @@ _GLIBCXX_END_NAMESPACE_CXX11
/// Class for @c wchar_t mixed input and output file streams.
typedef basic_fstream<wchar_t> wfstream;
#endif
+
+#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Allocator = allocator<_CharT>>
+ class basic_syncbuf;
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Allocator = allocator<_CharT>>
+ class basic_osyncstream;
+
+ using syncbuf = basic_syncbuf<char>;
+ using osyncstream = basic_osyncstream<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ using wsyncbuf = basic_syncbuf<wchar_t>;
+ using wosyncstream = basic_osyncstream<wchar_t>;
+#endif
+#endif // C++20 && CXX11_ABI
+
/** @} */
_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/syncstream b/libstdc++-v3/include/std/syncstream
index 3cf2296..7a4f731 100644
--- a/libstdc++-v3/include/std/syncstream
+++ b/libstdc++-v3/include/std/syncstream
@@ -50,8 +50,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- template<typename _CharT, typename _Traits = char_traits<_CharT>,
- typename _Alloc = allocator<_CharT>>
+ template<typename _CharT, typename _Traits, typename _Alloc>
class basic_syncbuf : public __syncbuf_base<_CharT, _Traits>
{
public:
@@ -241,8 +240,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__mutex _M_mtx;
};
- template <typename _CharT, typename _Traits = char_traits<_CharT>,
- typename _Alloc = allocator<_CharT>>
+ template <typename _CharT, typename _Traits, typename _Alloc>
class basic_osyncstream : public basic_ostream<_CharT, _Traits>
{
using __ostream_type = basic_ostream<_CharT, _Traits>;
diff --git a/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc b/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc
new file mode 100644
index 0000000..48f733b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc
@@ -0,0 +1,119 @@
+// { dg-do compile }
+
+#include <iosfwd>
+
+namespace std
+{
+ // [iosfwd.syn]
+
+ template<class charT> struct char_traits;
+ template<> struct char_traits<char>;
+#if __cplusplus >= 202002L
+ template<> struct char_traits<char8_t>;
+#endif
+#if __cplusplus >= 201103L
+ template<> struct char_traits<char16_t>;
+ template<> struct char_traits<char32_t>;
+#endif
+ template<> struct char_traits<wchar_t>;
+
+ template<class T> class allocator;
+
+ template<class charT, class traits>
+ class basic_ios;
+ template<class charT, class traits>
+ class basic_streambuf;
+ template<class charT, class traits>
+ class basic_istream;
+ template<class charT, class traits>
+ class basic_ostream;
+ template<class charT, class traits>
+ class basic_iostream;
+
+_GLIBCXX_BEGIN_NAMESPACE_CXX11
+ template<class charT, class traits, class Allocator>
+ class basic_stringbuf;
+ template<class charT, class traits, class Allocator>
+ class basic_istringstream;
+ template<class charT, class traits, class Allocator>
+ class basic_ostringstream;
+ template<class charT, class traits, class Allocator>
+ class basic_stringstream;
+_GLIBCXX_END_NAMESPACE_CXX11
+
+ template<class charT, class traits>
+ class basic_filebuf;
+ template<class charT, class traits>
+ class basic_ifstream;
+ template<class charT, class traits>
+ class basic_ofstream;
+ template<class charT, class traits>
+ class basic_fstream;
+
+#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI
+ template<class charT, class traits, class Allocator>
+ class basic_syncbuf;
+ template<class charT, class traits, class Allocator>
+ class basic_osyncstream;
+#endif
+
+ template<class charT, class traits>
+ class istreambuf_iterator;
+ template<class charT, class traits>
+ class ostreambuf_iterator;
+
+ typedef basic_ios<char> ios;
+ typedef basic_ios<wchar_t> wios;
+
+ typedef basic_streambuf<char> streambuf;
+ typedef basic_istream<char> istream;
+ typedef basic_ostream<char> ostream;
+ typedef basic_iostream<char> iostream;
+
+ typedef basic_stringbuf<char> stringbuf;
+ typedef basic_istringstream<char> istringstream;
+ typedef basic_ostringstream<char> ostringstream;
+ typedef basic_stringstream<char> stringstream;
+
+
+ typedef basic_filebuf<char> filebuf;
+ typedef basic_ifstream<char> ifstream;
+ typedef basic_ofstream<char> ofstream;
+ typedef basic_fstream<char> fstream;
+
+#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI
+ typedef basic_syncbuf<char> syncbuf;
+ typedef basic_osyncstream<char> osyncstream;
+#endif
+
+ typedef basic_streambuf<wchar_t> wstreambuf;
+ typedef basic_istream<wchar_t> wistream;
+ typedef basic_ostream<wchar_t> wostream;
+ typedef basic_iostream<wchar_t> wiostream;
+
+ typedef basic_stringbuf<wchar_t> wstringbuf;
+ typedef basic_istringstream<wchar_t> wistringstream;
+ typedef basic_ostringstream<wchar_t> wostringstream;
+ typedef basic_stringstream<wchar_t> wstringstream;
+
+ typedef basic_filebuf<wchar_t> wfilebuf;
+ typedef basic_ifstream<wchar_t> wifstream;
+ typedef basic_ofstream<wchar_t> wofstream;
+ typedef basic_fstream<wchar_t> wfstream;
+
+#if __cplusplus >= 202002L
+ typedef basic_syncbuf<wchar_t> wsyncbuf;
+ typedef basic_osyncstream<wchar_t> wosyncstream;
+#endif
+
+ template<class state> class fpos;
+ typedef fpos<std::mbstate_t> streampos;
+ typedef fpos<std::mbstate_t> wstreampos;
+#if __cplusplus >= 202002L
+ typedef fpos<std::mbstate_t> u8streampos;
+#endif
+#if __cplusplus >= 201103L
+ typedef fpos<std::mbstate_t> u16streampos;
+ typedef fpos<std::mbstate_t> u32streampos;
+#endif
+}
diff --git a/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc b/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc
new file mode 100644
index 0000000..e2c9c9b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc
@@ -0,0 +1,214 @@
+// { dg-do compile { target c++11 } }
+
+#include <iosfwd>
+
+template<class, class> struct Same { static constexpr bool value = false; };
+template<class T> struct Same<T, T> { static constexpr bool value = true; };
+
+template<class T> using Traits = std::char_traits<T>;
+template<class T> using Alloc = std::allocator<T>;
+
+using std::basic_ios;
+
+static_assert(Same<basic_ios<char>,
+ basic_ios<char, Traits<char>>
+ >::value,
+ "std::basic_ios<char> has the correct default template argument");
+
+static_assert(Same<basic_ios<wchar_t>,
+ basic_ios<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_ios<wchar_t> has the correct default template argument");
+
+using std::basic_streambuf;
+
+static_assert(Same<basic_streambuf<char>,
+ basic_streambuf<char, Traits<char>>
+ >::value,
+ "std::basic_streambuf<char> has the correct default template argument");
+
+static_assert(Same<basic_streambuf<wchar_t>,
+ basic_streambuf<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_streambuf<wchar_t> has the correct default template argument");
+
+using std::basic_istream;
+
+static_assert(Same<basic_istream<char>,
+ basic_istream<char, Traits<char>>
+ >::value,
+ "std::basic_istream<char> has the correct default template argument");
+
+static_assert(Same<basic_istream<wchar_t>,
+ basic_istream<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_istream<wchar_t> has the correct default template argument");
+
+using std::basic_ostream;
+
+static_assert(Same<basic_ostream<char>,
+ basic_ostream<char, Traits<char>>
+ >::value,
+ "std::basic_ostream<char> has the correct default template argument");
+
+static_assert(Same<basic_ostream<wchar_t>,
+ basic_ostream<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_ostream<wchar_t> has the correct default template argument");
+
+using std::basic_iostream;
+
+static_assert(Same<basic_iostream<char>,
+ basic_iostream<char, Traits<char>>>::value,
+ "std::basic_iostream<char> has the correct default template argument");
+
+static_assert(Same<basic_iostream<wchar_t>,
+ basic_iostream<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_iostream<wchar_t> has the correct default template argument");
+
+using std::basic_stringbuf;
+
+static_assert(Same<basic_stringbuf<char>,
+ basic_stringbuf<char, Traits<char>, Alloc<char>>
+ >::value,
+ "std::basic_stringbuf<char> has the correct default template argument");
+
+static_assert(Same<basic_stringbuf<wchar_t>,
+ basic_stringbuf<wchar_t, Traits<wchar_t>, Alloc<wchar_t>>
+ >::value,
+ "std::basic_stringbuf<wchar_t> has the correct default template argument");
+
+using std::basic_istringstream;
+
+static_assert(Same<basic_istringstream<char>,
+ basic_istringstream<char, Traits<char>, Alloc<char>>
+ >::value,
+ "std::basic_istringstream<char> has the correct default template argument");
+
+static_assert(Same<basic_istringstream<wchar_t>,
+ basic_istringstream<wchar_t, Traits<wchar_t>, Alloc<wchar_t>>
+ >::value,
+ "std::basic_istringstream<wchar_t> has the correct default template argument");
+
+using std::basic_ostringstream;
+
+static_assert(Same<basic_ostringstream<char>,
+ basic_ostringstream<char, Traits<char>, Alloc<char>>
+ >::value,
+ "std::basic_ostringstream<char> has the correct default template argument");
+
+static_assert(Same<basic_ostringstream<wchar_t>,
+ basic_ostringstream<wchar_t, Traits<wchar_t>, Alloc<wchar_t>>
+ >::value,
+ "std::basic_ostringstream<wchar_t> has the correct default template argument");
+
+using std::basic_stringstream;
+
+static_assert(Same<basic_stringstream<char>,
+ basic_stringstream<char, Traits<char>, Alloc<char>>
+ >::value,
+ "std::basic_stringstream<char> has the correct default template argument");
+
+static_assert(Same<basic_stringstream<wchar_t>,
+ basic_stringstream<wchar_t, Traits<wchar_t>, Alloc<wchar_t>>
+ >::value,
+ "std::basic_stringstream<wchar_t> has the correct default template argument");
+
+using std::basic_filebuf;
+
+static_assert(Same<basic_filebuf<char>,
+ basic_filebuf<char, Traits<char>>
+ >::value,
+ "std::basic_filebuf<char> has the correct default template argument");
+
+static_assert(Same<basic_filebuf<wchar_t>,
+ basic_filebuf<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_filebuf<wchar_t> has the correct default template argument");
+
+using std::basic_ifstream;
+
+static_assert(Same<basic_ifstream<char>,
+ basic_ifstream<char, Traits<char>>
+ >::value,
+ "std::basic_ifstream<char> has the correct default template argument");
+
+static_assert(Same<basic_ifstream<wchar_t>,
+ basic_ifstream<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_ifstream<wchar_t> has the correct default template argument");
+
+using std::basic_ofstream;
+
+static_assert(Same<basic_ofstream<char>,
+ basic_ofstream<char, Traits<char>>
+ >::value,
+ "std::basic_ofstream<char> has the correct default template argument");
+
+static_assert(Same<basic_ofstream<wchar_t>,
+ basic_ofstream<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_ofstream<wchar_t> has the correct default template argument");
+
+using std::basic_fstream;
+
+static_assert(Same<basic_fstream<char>,
+ basic_fstream<char, Traits<char>>
+ >::value,
+ "std::basic_fstream<char> has the correct default template argument");
+
+static_assert(Same<basic_fstream<wchar_t>,
+ basic_fstream<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_fstream<wchar_t> has the correct default template argument");
+
+#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI
+using std::basic_syncbuf;
+
+static_assert(Same<basic_syncbuf<char>,
+ basic_syncbuf<char, Traits<char>, Alloc<char>>
+ >::value,
+ "std::basic_syncbuf<char> has the correct default template argument");
+
+static_assert(Same<basic_syncbuf<wchar_t>,
+ basic_syncbuf<wchar_t, Traits<wchar_t>, Alloc<wchar_t>>
+ >::value,
+ "std::basic_syncbuf<wchar_t> has the correct default template argument");
+
+using std::basic_osyncstream;
+
+static_assert(Same<basic_osyncstream<char>,
+ basic_osyncstream<char, Traits<char>, Alloc<char>>
+ >::value,
+ "std::basic_osyncstream<char> has the correct default template argument");
+
+static_assert(Same<basic_osyncstream<wchar_t>,
+ basic_osyncstream<wchar_t, Traits<wchar_t>, Alloc<wchar_t>>
+ >::value,
+ "std::basic_osyncstream<wchar_t> has the correct default template argument");
+#endif
+
+using std::istreambuf_iterator;
+
+static_assert(Same<istreambuf_iterator<char>,
+ istreambuf_iterator<char, Traits<char>>
+ >::value,
+ "std::istreambuf_iterator<char> has the correct default template argument");
+
+static_assert(Same<istreambuf_iterator<wchar_t>,
+ istreambuf_iterator<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::istreambuf_iterator<wchar_t> has the correct default template argument");
+
+using std::ostreambuf_iterator;
+
+static_assert(Same<ostreambuf_iterator<char>,
+ ostreambuf_iterator<char, Traits<char>>
+ >::value,
+ "std::ostreambuf_iterator<char> has the correct default template argument");
+
+static_assert(Same<ostreambuf_iterator<wchar_t>,
+ ostreambuf_iterator<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::ostreambuf_iterator<wchar_t> has the correct default template argument");