From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id C36B93856DFC for ; Tue, 10 May 2022 15:43:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C36B93856DFC Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-146-IJqD1D4ANj-pH9F1F4MckA-1; Tue, 10 May 2022 11:43:37 -0400 X-MC-Unique: IJqD1D4ANj-pH9F1F4MckA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 06F35384F810; Tue, 10 May 2022 15:43:37 +0000 (UTC) Received: from localhost (unknown [10.33.36.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6C92C15D76; Tue, 10 May 2022 15:43:36 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 1/2] libstdc++: Add declarations to [PR105284] Date: Tue, 10 May 2022 16:43:34 +0100 Message-Id: <20220510154335.3714947-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2022 15:43:42 -0000 Tested powerpc64le-linux, pushed to trunk. -- >8 -- 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. --- libstdc++-v3/include/std/iosfwd | 18 ++ libstdc++-v3/include/std/syncstream | 6 +- .../27_io/headers/iosfwd/synopsis.cc | 119 ++++++++++ .../testsuite/27_io/headers/iosfwd/types.cc | 214 ++++++++++++++++++ 4 files changed, 353 insertions(+), 4 deletions(-) create mode 100644 libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc create mode 100644 libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc diff --git a/libstdc++-v3/include/std/iosfwd b/libstdc++-v3/include/std/iosfwd index 2d79a131631..c8c67c86c3b 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 3cf2296f723..7a4f731ddd9 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"); -- 2.34.1