From patchwork Fri Mar 1 14:23:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1906749 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UpWRSFgZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TmWk95Mzbz1yX7 for ; Sat, 2 Mar 2024 02:10:41 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A55B53858402 for ; Fri, 1 Mar 2024 15:10:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id DCBF43858C39 for ; Fri, 1 Mar 2024 15:09:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DCBF43858C39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DCBF43858C39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709305762; cv=none; b=eiXyd7qPKr5H9gvZ58riGVIIfRVIUXAUiq7RcSWXI8lKDwvTMniQZeN3yk/R0yweY5ndbsArWAQM/RsBDfp5+s25WFczLns+3pFpoJQ28XtMTLxFL3MzUQlGggOD6Z51T/yqCilsshVmrLTLzznxSgXPi9rTlaKk3stscHCFwkA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709305762; c=relaxed/simple; bh=fIp4frHpct5bdu29FC2mwv+1XApPX/sxmubeuJI4QRY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=KC1abqE4AfIZ1OMBNGlmYS+2WVUGGlJ8BMugKybCikhoUkF3SaLwyj6x+kSXr8wIjTxvdaZGXEuyxrM8yQoiJ/rU1YQudSiIhPnRb8CBvTYvgEkxlTPDxFxAVzB2ZFfpEqXo6TZ+AodlV/4VSh1bVe7vTj8LbR15KNe5hiDOOfc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709305758; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CEoQNwO/3wseXq9iRTgwLApH0X/2ZV9T3Hz0eKcV/zk=; b=UpWRSFgZRRNjWR5lNdjUKtnbCKj6iLCxQBHsyBKGsSHnJEoDJy+kkWmt1Ie61l0Y3LA6LY sTbJmr7N9hQ4IGD+nLHmrhb0Rdy1hxexZ1PwzcggXBOmHYs5R7Xic8FteuC3pCR3fbLkU7 5/HoTRqP6C5+8BE15M6+D+tIZKFdbY4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-288-CKPDTCZRPNOWz0Xfql7afA-1; Fri, 01 Mar 2024 10:09:16 -0500 X-MC-Unique: CKPDTCZRPNOWz0Xfql7afA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0602811BB5EA; Fri, 1 Mar 2024 15:09:16 +0000 (UTC) Received: from localhost (unknown [10.42.28.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id C291420229A4; Fri, 1 Mar 2024 15:09:15 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Ville Voutilainen , Patrick Palka Subject: [PATCH] libstdc++: Add missing std::tuple constructor [PR114147] Date: Fri, 1 Mar 2024 14:23:32 +0000 Message-ID: <20240301150915.92103-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, URI_HEX autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org This fixes a regression on all active branches. Tested aarch64-linux. -- >8 -- 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. --- libstdc++-v3/include/std/tuple | 14 ++++++++++++++ .../testsuite/20_util/tuple/cons/114147.cc | 15 +++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 libstdc++-v3/testsuite/20_util/tuple/cons/114147.cc diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 9c89c13ab84..3065058e184 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -1550,6 +1550,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 @@ -2198,6 +2205,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);