aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-10-19 11:38:26 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-10-19 15:01:16 +0100
commitc4ecb11e4f7ea15f636e463248c8b14083bef05d (patch)
treec15949dcdb9dfa630f1571f41f048450f13f2aad
parent82b2e4f8cf5a01c6724fe3f465a77ee03cfcaae2 (diff)
downloadgcc-c4ecb11e4f7ea15f636e463248c8b14083bef05d.zip
gcc-c4ecb11e4f7ea15f636e463248c8b14083bef05d.tar.gz
gcc-c4ecb11e4f7ea15f636e463248c8b14083bef05d.tar.bz2
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.
-rw-r--r--libstdc++-v3/include/bits/stl_stack.h2
-rw-r--r--libstdc++-v3/testsuite/23_containers/stack/deduction.cc14
2 files changed, 15 insertions, 1 deletions
diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h
index 429743f..76b2e24 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<typename _Container::value_type, _Container>;
#ifdef __cpp_lib_adaptor_iterator_pair_constructor
- template<typename _InputIterator, typename _Allocator,
+ template<typename _InputIterator,
typename _ValT
= typename iterator_traits<_InputIterator>::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 169a063..dea7ba0 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<std::stack<long, std::list<long>>>(s8);
}
+
+#if __cpp_lib_adaptor_iterator_pair_constructor
+void
+test03()
+{
+ std::list<long> l;
+
+ std::stack s1(l.begin(), l.end());
+ check_type<std::stack<long>>(s1);
+
+ std::stack s2(l.begin(), l.end(), std::allocator<long>());
+ check_type<std::stack<long>>(s1);
+}
+#endif