From 1a129376bbc26d3c30af3c1ae6036e2e1446db40 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 23 Aug 2021 16:16:05 +0100 Subject: [PATCH] libstdc++: Add default template argument to basic_istream_view The standard shows this default template argument in the synopsis, but it was missing in libstdc++. libstdc++-v3/ChangeLog: * include/std/ranges (basic_istream_view): Add default template argument. * testsuite/std/ranges/istream_view.cc: Check it. --- libstdc++-v3/include/std/ranges | 3 ++- libstdc++-v3/testsuite/std/ranges/istream_view.cc | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 3d49a26ee79..b373e4f05c0 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -679,7 +679,8 @@ namespace views = requires(basic_istream<_CharT, _Traits>& is, _Val& t) { is >> t; }; } // namespace __detail - template + template> requires default_initializable<_Val> && __detail::__stream_extractable<_Val, _CharT, _Traits> class basic_istream_view diff --git a/libstdc++-v3/testsuite/std/ranges/istream_view.cc b/libstdc++-v3/testsuite/std/ranges/istream_view.cc index 2f15f787250..f5c0c2a6bb0 100644 --- a/libstdc++-v3/testsuite/std/ranges/istream_view.cc +++ b/libstdc++-v3/testsuite/std/ranges/istream_view.cc @@ -94,6 +94,15 @@ test05() ; } +void +test06() +{ + // Default template argument + using V = std::ranges::basic_istream_view; + using W = std::ranges::basic_istream_view>; + static_assert( std::is_same_v ); +} + int main() { @@ -102,4 +111,5 @@ main() test03(); test04(); test05(); + test06(); }