public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-4507] libstdc++: Fix std::stack deduction guide
Date: Tue, 19 Oct 2021 14:01:52 +0000 (GMT)	[thread overview]
Message-ID: <20211019140152.C6F63385843F@sourceware.org> (raw)

https://gcc.gnu.org/g:c4ecb11e4f7ea15f636e463248c8b14083bef05d

commit r12-4507-gc4ecb11e4f7ea15f636e463248c8b14083bef05d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Oct 19 11:38:26 2021 +0100

    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:
---
 libstdc++-v3/include/bits/stl_stack.h                   |  2 +-
 libstdc++-v3/testsuite/23_containers/stack/deduction.cc | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h
index 429743f5514..76b2e242c37 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 169a063687b..dea7ba060d9 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


                 reply	other threads:[~2021-10-19 14:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211019140152.C6F63385843F@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).