From ca97c87758d450a946cac31b0db43da0039fabf1 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 10 May 2022 13:06:47 +0100 Subject: [PATCH] libstdc++: Add declarations to [PR105284] libstdc++-v3/ChangeLog: PR libstdc++/105284 * include/std/iosfwd: Add declarations for class templates and typedefs. * include/std/spanstream (basic_spanbuf, basic_ispanstream) (basic_ospanstream, basic_spanstream): Remove default template arguments. * testsuite/27_io/headers/iosfwd/synopsis.cc: Add declarations. * testsuite/27_io/headers/iosfwd/types.cc: Check default arguments. --- libstdc++-v3/include/std/iosfwd | 23 ++++++++++ libstdc++-v3/include/std/spanstream | 8 ++-- .../testsuite/27_io/headers/iosfwd/synopsis.cc | 13 ++++++ .../testsuite/27_io/headers/iosfwd/types.cc | 50 ++++++++++++++++++++++ 4 files changed, 90 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/include/std/iosfwd b/libstdc++-v3/include/std/iosfwd index c8c67c8..ddf0c95 100644 --- a/libstdc++-v3/include/std/iosfwd +++ b/libstdc++-v3/include/std/iosfwd @@ -225,6 +225,29 @@ _GLIBCXX_END_NAMESPACE_CXX11 #endif #endif // C++20 && CXX11_ABI +#if __cplusplus > 202002L + template> + class basic_spanbuf; + template> + class basic_ispanstream; + template> + class basic_ospanstream; + template> + class basic_spanstream; + + using spanbuf = basic_spanbuf; + using ispanstream = basic_ispanstream; + using ospanstream = basic_ospanstream; + using spanstream = basic_spanstream; + +#ifdef _GLIBCXX_USE_WCHAR_T + using wspanbuf = basic_spanbuf; + using wispanstream = basic_ispanstream; + using wospanstream = basic_ospanstream; + using wspanstream = basic_spanstream; +#endif +#endif // C++23 + /** @} */ _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/std/spanstream b/libstdc++-v3/include/std/spanstream index 000bda5..5855b28 100644 --- a/libstdc++-v3/include/std/spanstream +++ b/libstdc++-v3/include/std/spanstream @@ -45,7 +45,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #define __cpp_lib_spanstream 202106L -template> +template class basic_spanbuf : public basic_streambuf<_CharT, _Traits> { @@ -218,7 +218,7 @@ template using spanbuf = basic_spanbuf; using wspanbuf = basic_spanbuf; -template> +template class basic_ispanstream : public basic_istream<_CharT, _Traits> { @@ -310,7 +310,7 @@ template using ispanstream = basic_ispanstream; using wispanstream = basic_ispanstream; -template> +template class basic_ospanstream : public basic_ostream<_CharT, _Traits> { @@ -378,7 +378,7 @@ template using ospanstream = basic_ospanstream; using wospanstream = basic_ospanstream; -template> +template class basic_spanstream : public basic_iostream<_CharT, _Traits> { diff --git a/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc b/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc index 48f733b..467d636 100644 --- a/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc +++ b/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc @@ -75,6 +75,12 @@ _GLIBCXX_END_NAMESPACE_CXX11 typedef basic_ostringstream ostringstream; typedef basic_stringstream stringstream; +#if __cplusplus > 202002L + typedef basic_spanbuf spanbuf; + typedef basic_ispanstream ispanstream; + typedef basic_ospanstream ospanstream; + typedef basic_spanstream spanstream; +#endif typedef basic_filebuf filebuf; typedef basic_ifstream ifstream; @@ -96,6 +102,13 @@ _GLIBCXX_END_NAMESPACE_CXX11 typedef basic_ostringstream wostringstream; typedef basic_stringstream wstringstream; +#if __cplusplus > 202002L + typedef basic_spanbuf wspanbuf; + typedef basic_ispanstream wispanstream; + typedef basic_ospanstream wospanstream; + typedef basic_spanstream wspanstream; +#endif + typedef basic_filebuf wfilebuf; typedef basic_ifstream wifstream; typedef basic_ofstream wofstream; diff --git a/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc b/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc index e2c9c9b..baf37e9 100644 --- a/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc +++ b/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc @@ -115,6 +115,56 @@ static_assert(Same, >::value, "std::basic_stringstream has the correct default template argument"); +#if __cplusplus > 202002L +using std::basic_spanbuf; + +static_assert(Same, + basic_spanbuf> + >::value, + "std::basic_spanbuf has the correct default template argument"); + +static_assert(Same, + basic_spanbuf> + >::value, + "std::basic_spanbuf has the correct default template argument"); + +using std::basic_ispanstream; + +static_assert(Same, + basic_ispanstream> + >::value, + "std::basic_ispanstream has the correct default template argument"); + +static_assert(Same, + basic_ispanstream> + >::value, + "std::basic_ispanstream has the correct default template argument"); + +using std::basic_ospanstream; + +static_assert(Same, + basic_ospanstream> + >::value, + "std::basic_ospanstream has the correct default template argument"); + +static_assert(Same, + basic_ospanstream> + >::value, + "std::basic_ospanstream has the correct default template argument"); + +using std::basic_spanstream; + +static_assert(Same, + basic_spanstream> + >::value, + "std::basic_spanstream has the correct default template argument"); + +static_assert(Same, + basic_spanstream> + >::value, + "std::basic_spanstream has the correct default template argument"); +#endif + using std::basic_filebuf; static_assert(Same, -- 2.7.4