From: Jonathan Wakely Date: Tue, 19 Oct 2021 10:38:26 +0000 (+0100) Subject: libstdc++: Fix std::stack deduction guide X-Git-Tag: basepoints/gcc-13~3806 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4ecb11e4f7ea15f636e463248c8b14083bef05d;p=thirdparty%2Fgcc.git libstdc++: Fix std::stack deduction guide libstdc++-v3/ChangeLog: * include/bits/stl_stack.h (stack(Iterator, Iterator)): Remove non-deducible template parameter from deduction guide. * testsuite/23_containers/stack/deduction.cc: Check new C++23 deduction guides. --- diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h index 429743f5514c..76b2e242c37f 100644 --- a/libstdc++-v3/include/bits/stl_stack.h +++ b/libstdc++-v3/include/bits/stl_stack.h @@ -322,7 +322,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION -> stack; #ifdef __cpp_lib_adaptor_iterator_pair_constructor - template::value_type, typename = _RequireInputIter<_InputIterator>> diff --git a/libstdc++-v3/testsuite/23_containers/stack/deduction.cc b/libstdc++-v3/testsuite/23_containers/stack/deduction.cc index 169a063687b5..dea7ba060d92 100644 --- a/libstdc++-v3/testsuite/23_containers/stack/deduction.cc +++ b/libstdc++-v3/testsuite/23_containers/stack/deduction.cc @@ -87,3 +87,17 @@ test02() std::stack s8(std::move(l), l.get_allocator()); check_type>>(s8); } + +#if __cpp_lib_adaptor_iterator_pair_constructor +void +test03() +{ + std::list l; + + std::stack s1(l.begin(), l.end()); + check_type>(s1); + + std::stack s2(l.begin(), l.end(), std::allocator()); + check_type>(s1); +} +#endif