From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 162C338425B0; Tue, 10 May 2022 19:34:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 162C338425B0 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-9977] libstdc++: Add declarations to [PR105284] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 6b5ca56fec4f713add424a5131350b28ce81e9da X-Git-Newrev: 1572e41d759950e7699d14779aae49b892f12f8b Message-Id: <20220510193459.162C338425B0@sourceware.org> Date: Tue, 10 May 2022 19:34:59 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2022 19:34:59 -0000 https://gcc.gnu.org/g:1572e41d759950e7699d14779aae49b892f12f8b commit r11-9977-g1572e41d759950e7699d14779aae49b892f12f8b Author: Jonathan Wakely Date: Tue May 10 13:03:14 2022 +0100 libstdc++: Add declarations to [PR105284] libstdc++-v3/ChangeLog: PR libstdc++/105284 * include/std/iosfwd: Add declarations for class templates and typedefs. * include/std/syncstream (basic_syncbuf, basic_osyncstream): Remove default template arguments. * testsuite/27_io/headers/iosfwd/synopsis.cc: New test. * testsuite/27_io/headers/iosfwd/types.cc: New test. (cherry picked from commit 1807e07825a86916bbfddca470708c5a8f613612) Diff: --- libstdc++-v3/include/std/iosfwd | 18 ++ libstdc++-v3/include/std/syncstream | 6 +- .../testsuite/27_io/headers/iosfwd/synopsis.cc | 119 ++++++++++++ .../testsuite/27_io/headers/iosfwd/types.cc | 214 +++++++++++++++++++++ 4 files changed, 353 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/include/std/iosfwd b/libstdc++-v3/include/std/iosfwd index 52fa4b6cccb..610383992fb 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 wfstream; #endif + +#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI + template, + typename _Allocator = allocator<_CharT>> + class basic_syncbuf; + template, + typename _Allocator = allocator<_CharT>> + class basic_osyncstream; + + using syncbuf = basic_syncbuf; + using osyncstream = basic_osyncstream; + +#ifdef _GLIBCXX_USE_WCHAR_T + using wsyncbuf = basic_syncbuf; + using wosyncstream = basic_osyncstream; +#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 db6ebd50471..ac39d0f2243 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 _Alloc = allocator<_CharT>> + template class basic_syncbuf : public __syncbuf_base<_CharT, _Traits> { public: @@ -241,8 +240,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __mutex _M_mtx; }; - template , - typename _Alloc = allocator<_CharT>> + template 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 00000000000..48f733bf28a --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc @@ -0,0 +1,119 @@ +// { dg-do compile } + +#include + +namespace std +{ + // [iosfwd.syn] + + template struct char_traits; + template<> struct char_traits; +#if __cplusplus >= 202002L + template<> struct char_traits; +#endif +#if __cplusplus >= 201103L + template<> struct char_traits; + template<> struct char_traits; +#endif + template<> struct char_traits; + + template class allocator; + + template + class basic_ios; + template + class basic_streambuf; + template + class basic_istream; + template + class basic_ostream; + template + class basic_iostream; + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template + class basic_stringbuf; + template + class basic_istringstream; + template + class basic_ostringstream; + template + class basic_stringstream; +_GLIBCXX_END_NAMESPACE_CXX11 + + template + class basic_filebuf; + template + class basic_ifstream; + template + class basic_ofstream; + template + class basic_fstream; + +#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI + template + class basic_syncbuf; + template + class basic_osyncstream; +#endif + + template + class istreambuf_iterator; + template + class ostreambuf_iterator; + + typedef basic_ios ios; + typedef basic_ios wios; + + typedef basic_streambuf streambuf; + typedef basic_istream istream; + typedef basic_ostream ostream; + typedef basic_iostream iostream; + + typedef basic_stringbuf stringbuf; + typedef basic_istringstream istringstream; + typedef basic_ostringstream ostringstream; + typedef basic_stringstream stringstream; + + + typedef basic_filebuf filebuf; + typedef basic_ifstream ifstream; + typedef basic_ofstream ofstream; + typedef basic_fstream fstream; + +#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI + typedef basic_syncbuf syncbuf; + typedef basic_osyncstream osyncstream; +#endif + + typedef basic_streambuf wstreambuf; + typedef basic_istream wistream; + typedef basic_ostream wostream; + typedef basic_iostream wiostream; + + typedef basic_stringbuf wstringbuf; + typedef basic_istringstream wistringstream; + typedef basic_ostringstream wostringstream; + typedef basic_stringstream wstringstream; + + typedef basic_filebuf wfilebuf; + typedef basic_ifstream wifstream; + typedef basic_ofstream wofstream; + typedef basic_fstream wfstream; + +#if __cplusplus >= 202002L + typedef basic_syncbuf wsyncbuf; + typedef basic_osyncstream wosyncstream; +#endif + + template class fpos; + typedef fpos streampos; + typedef fpos wstreampos; +#if __cplusplus >= 202002L + typedef fpos u8streampos; +#endif +#if __cplusplus >= 201103L + typedef fpos u16streampos; + typedef fpos 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 00000000000..e2c9c9b8dfa --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc @@ -0,0 +1,214 @@ +// { dg-do compile { target c++11 } } + +#include + +template struct Same { static constexpr bool value = false; }; +template struct Same { static constexpr bool value = true; }; + +template using Traits = std::char_traits; +template using Alloc = std::allocator; + +using std::basic_ios; + +static_assert(Same, + basic_ios> + >::value, + "std::basic_ios has the correct default template argument"); + +static_assert(Same, + basic_ios> + >::value, + "std::basic_ios has the correct default template argument"); + +using std::basic_streambuf; + +static_assert(Same, + basic_streambuf> + >::value, + "std::basic_streambuf has the correct default template argument"); + +static_assert(Same, + basic_streambuf> + >::value, + "std::basic_streambuf has the correct default template argument"); + +using std::basic_istream; + +static_assert(Same, + basic_istream> + >::value, + "std::basic_istream has the correct default template argument"); + +static_assert(Same, + basic_istream> + >::value, + "std::basic_istream has the correct default template argument"); + +using std::basic_ostream; + +static_assert(Same, + basic_ostream> + >::value, + "std::basic_ostream has the correct default template argument"); + +static_assert(Same, + basic_ostream> + >::value, + "std::basic_ostream has the correct default template argument"); + +using std::basic_iostream; + +static_assert(Same, + basic_iostream>>::value, + "std::basic_iostream has the correct default template argument"); + +static_assert(Same, + basic_iostream> + >::value, + "std::basic_iostream has the correct default template argument"); + +using std::basic_stringbuf; + +static_assert(Same, + basic_stringbuf, Alloc> + >::value, + "std::basic_stringbuf has the correct default template argument"); + +static_assert(Same, + basic_stringbuf, Alloc> + >::value, + "std::basic_stringbuf has the correct default template argument"); + +using std::basic_istringstream; + +static_assert(Same, + basic_istringstream, Alloc> + >::value, + "std::basic_istringstream has the correct default template argument"); + +static_assert(Same, + basic_istringstream, Alloc> + >::value, + "std::basic_istringstream has the correct default template argument"); + +using std::basic_ostringstream; + +static_assert(Same, + basic_ostringstream, Alloc> + >::value, + "std::basic_ostringstream has the correct default template argument"); + +static_assert(Same, + basic_ostringstream, Alloc> + >::value, + "std::basic_ostringstream has the correct default template argument"); + +using std::basic_stringstream; + +static_assert(Same, + basic_stringstream, Alloc> + >::value, + "std::basic_stringstream has the correct default template argument"); + +static_assert(Same, + basic_stringstream, Alloc> + >::value, + "std::basic_stringstream has the correct default template argument"); + +using std::basic_filebuf; + +static_assert(Same, + basic_filebuf> + >::value, + "std::basic_filebuf has the correct default template argument"); + +static_assert(Same, + basic_filebuf> + >::value, + "std::basic_filebuf has the correct default template argument"); + +using std::basic_ifstream; + +static_assert(Same, + basic_ifstream> + >::value, + "std::basic_ifstream has the correct default template argument"); + +static_assert(Same, + basic_ifstream> + >::value, + "std::basic_ifstream has the correct default template argument"); + +using std::basic_ofstream; + +static_assert(Same, + basic_ofstream> + >::value, + "std::basic_ofstream has the correct default template argument"); + +static_assert(Same, + basic_ofstream> + >::value, + "std::basic_ofstream has the correct default template argument"); + +using std::basic_fstream; + +static_assert(Same, + basic_fstream> + >::value, + "std::basic_fstream has the correct default template argument"); + +static_assert(Same, + basic_fstream> + >::value, + "std::basic_fstream has the correct default template argument"); + +#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI +using std::basic_syncbuf; + +static_assert(Same, + basic_syncbuf, Alloc> + >::value, + "std::basic_syncbuf has the correct default template argument"); + +static_assert(Same, + basic_syncbuf, Alloc> + >::value, + "std::basic_syncbuf has the correct default template argument"); + +using std::basic_osyncstream; + +static_assert(Same, + basic_osyncstream, Alloc> + >::value, + "std::basic_osyncstream has the correct default template argument"); + +static_assert(Same, + basic_osyncstream, Alloc> + >::value, + "std::basic_osyncstream has the correct default template argument"); +#endif + +using std::istreambuf_iterator; + +static_assert(Same, + istreambuf_iterator> + >::value, + "std::istreambuf_iterator has the correct default template argument"); + +static_assert(Same, + istreambuf_iterator> + >::value, + "std::istreambuf_iterator has the correct default template argument"); + +using std::ostreambuf_iterator; + +static_assert(Same, + ostreambuf_iterator> + >::value, + "std::ostreambuf_iterator has the correct default template argument"); + +static_assert(Same, + ostreambuf_iterator> + >::value, + "std::ostreambuf_iterator has the correct default template argument");