From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id E7FF73858C50; Mon, 18 Mar 2024 14:03:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7FF73858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710770600; bh=STPrc9JdxgFXMZZwZGRnTtEM9HXwS0tto2TxAl5DuwU=; h=From:To:Subject:Date:From; b=i6MYmLdKrvsFhShNzA0/3WZX8cznXr5kdBb/pfOESQu95gYNJY03hiSyaJWR2AniC /a4JyXWPJS6HQzOdKe/9wjOBjMFWg9h5OBTAzELZ+SB5KyEd5TQm4zzGs9iwKbZCcU CYTV5ZmwuG9BNEN5tGd+GPKTPW/EvxaMhIKyWv2k= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-10221] libstdc++: Add missing std::tuple constructor [PR114147] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: b011a8d741ddd49bf90a83475bb1cbded837d5bd X-Git-Newrev: fbdeeb1604d52a8ece8631f70ecd64d925d31741 Message-Id: <20240318140320.E7FF73858C50@sourceware.org> Date: Mon, 18 Mar 2024 14:03:20 +0000 (GMT) List-Id: https://gcc.gnu.org/g:fbdeeb1604d52a8ece8631f70ecd64d925d31741 commit r12-10221-gfbdeeb1604d52a8ece8631f70ecd64d925d31741 Author: Jonathan Wakely Date: Fri Mar 1 11:16:58 2024 +0000 libstdc++: Add missing std::tuple constructor [PR114147] I caused a regression with commit r10-908 by adding a constraint to the non-explicit allocator-extended default constructor, but seemingly forgot to add an explicit overload with the corresponding constraint. libstdc++-v3/ChangeLog: PR libstdc++/114147 * include/std/tuple (tuple::tuple(allocator_arg_t, const Alloc&)): Add missing overload of allocator-extended default constructor. (tuple::tuple(allocator_arg_t, const Alloc&)): Likewise. * testsuite/20_util/tuple/cons/114147.cc: New test. (cherry picked from commit 0a545ac7000501844670add0b3560ebdbcb123c6) Diff: --- libstdc++-v3/include/std/tuple | 14 ++++++++++++++ libstdc++-v3/testsuite/20_util/tuple/cons/114147.cc | 15 +++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 6d0060a191c..04b77113a84 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -801,6 +801,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION tuple(allocator_arg_t __tag, const _Alloc& __a) : _Inherited(__tag, __a) { } + template::value> = false> + _GLIBCXX20_CONSTEXPR + explicit + tuple(allocator_arg_t __tag, const _Alloc& __a) + : _Inherited(__tag, __a) { } + template= 1), _ImplicitCtor<_NotEmpty, const _Elements&...> = true> _GLIBCXX20_CONSTEXPR @@ -1155,6 +1162,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION tuple(allocator_arg_t __tag, const _Alloc& __a) : _Inherited(__tag, __a) { } + template::value, _T1, _T2> = false> + _GLIBCXX20_CONSTEXPR + explicit + tuple(allocator_arg_t __tag, const _Alloc& __a) + : _Inherited(__tag, __a) { } + template = true> _GLIBCXX20_CONSTEXPR diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/114147.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/114147.cc new file mode 100644 index 00000000000..916e7204964 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/114147.cc @@ -0,0 +1,15 @@ +// { dg-do compile { target c++11 } } + +// PR libstdc++/114147 +// tuple allocator-extended ctor requires non-explicit default ctor + +#include +#include + +struct X { explicit X(); }; + +std::allocator a; +std::tuple t0(std::allocator_arg, a); +std::tuple t1(std::allocator_arg, a); +std::tuple t2(std::allocator_arg, a); +std::tuple t3(std::allocator_arg, a);