From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id C9F3C3858D28 for ; Wed, 24 Jan 2024 21:17:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C9F3C3858D28 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 C9F3C3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706131032; cv=none; b=uBwaQtHI7BGxfGCiiWrkQt4dX93xP9CBSwTkCwDcFC6QTtZoTzQ9oJy6gzs/Bj7WmoFIQOaJziSaiXOT9GXdrgfVisuSnNU/qCukmmRsWUFcHumqdLnMs26MmynRA+Gqk6eEExQD2NjGK+2SbIJTD5ldYjduQTdyL9LkkBar6Q4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706131032; c=relaxed/simple; bh=GpCUnQW7Xb/+yH5GVO2c21+UQGwt4JC93Re/vWT59Hk=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=hZ4xjJaM5oPvUkCnoRmpIfA3F9CfPV9m1iqKxDBkBEk/vDq17RGujW/o8aZ6DSmIkIXUf8kiR/kM1wDCrp7YqnHRJpdsec5U0ELZdSmttwkXUbZKcW0IdjRkjaX5dhN9BGZpFWBTPTFD1spbx5BlDh/JzZ9qMYc6H8dbk1JdvYc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706131030; 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: in-reply-to:in-reply-to:references:references; bh=OJamnNPFXOuHUaZKpslUxsncUBHS/lPfFwmFFxMpDo8=; b=A49n11bCDnJ1qRIb7oOKT/3q6ZEsPBRe945h1VTfqCkZ8q5cTj1RZ34VHfRQ/Kp/TCh1Ld Z0AVaTfgCRyc3RDroNfs1Tmaew1F2D6tyoG+6kGHlUSiRzX4rZak5xnaZ/l5/udUk0Gjn7 kUrVG/IvWg7VuBgYz6eLZnAwUA8hct0= Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-381-DTEwllzYPHGI18NqvZPqMQ-1; Wed, 24 Jan 2024 16:17:09 -0500 X-MC-Unique: DTEwllzYPHGI18NqvZPqMQ-1 Received: by mail-ot1-f71.google.com with SMTP id 46e09a7af769-6e0ee5097feso4635699a34.1 for ; Wed, 24 Jan 2024 13:17:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706131028; x=1706735828; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OJamnNPFXOuHUaZKpslUxsncUBHS/lPfFwmFFxMpDo8=; b=dm/mv2/5ARMz0dFIAMd3LKGAvipECVT/JCo0PqY8Utf7DEroefrs/uW6FfKIckmEHV xkmHf1/Eb1VTHemm/hmUsrMTaFRiLkz/DaK16esNODW2Tk+asivbT5aE6birkCiUcxTI gnUPJHb/h1xMWxgV7VqO21/0EyPkfCrP0WpRnYygskM+0AfLDdYBKNOtYcYyp1hm/28Z J34DCHQXTto+gYMqgaOg+ZD50cCUntPjdWLDzBj5yPy6BFdGUkqTVUeDWFjaGi4ecKUG yrjOFrWc14y1Nd1HD1uy12AtSm7k7UYnnM234TD522MJRJA84YUORsJEGe1GhG6GcsWM fOEw== X-Gm-Message-State: AOJu0Yxf3OPDkVxyBMj8mDGwb2Wb2KSrpFCk6BkUdrYJbLhf6+LegLmy ZLmyh9YpyYB498DLuz7Juieg045a2zpTVXNeIPsyjqM/1iLw/iXuvBzFB76tc6BtyghKIumT1BJ ynoqDCu9MSo/ICu9swbUohFSkT/9VCi1IULbC0Yk2wLJmEAyOJq0hf5m+QLyWe/zAXR4T5wWXX1 T4Xzn+duHBTnKife/+2Z7lIjXbyMZxNw== X-Received: by 2002:a9d:6a4b:0:b0:6dd:de6b:1ccd with SMTP id h11-20020a9d6a4b000000b006ddde6b1ccdmr2083629otn.62.1706131028491; Wed, 24 Jan 2024 13:17:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEClYn+EBZpnMbOL/ie25F5gRgSiJ1m+7cBnLE8AXOBafV4ltz5r1XVtqqcJpWyVz+higO0UUDrsDKAiMWj7sY= X-Received: by 2002:a9d:6a4b:0:b0:6dd:de6b:1ccd with SMTP id h11-20020a9d6a4b000000b006ddde6b1ccdmr2083623otn.62.1706131028266; Wed, 24 Jan 2024 13:17:08 -0800 (PST) MIME-Version: 1.0 References: <20240123235303.1540890-1-ppalka@redhat.com> <20240123235303.1540890-2-ppalka@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Wed, 24 Jan 2024 21:16:52 +0000 Message-ID: Subject: Re: [PATCH 2/2] libstdc++: Implement P2165R4 changes to std::pair/tuple/etc To: Patrick Palka Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,URIBL_BLACK,URIBL_SBL_A autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 24 Jan 2024 at 17:27, Jonathan Wakely wrote: > > On Wed, 24 Jan 2024 at 15:24, Patrick Palka wrote: > > > > On Wed, 24 Jan 2024, Jonathan Wakely wrote: > > > > > On Tue, 23 Jan 2024 at 23:54, Patrick Palka wrote: > > > > @@ -1016,10 +1116,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > > > tuple(const pair<_U1, _U2>&&) = delete; > > > > #endif // C++23 > > > > > > > > -#if 0 && __cpp_lib_tuple_like // >= C++23 > > > > - template<__tuple_like _UTuple> > > > > - constexpr explicit(...) > > > > - tuple(_UTuple&& __u); > > > > +#if __cpp_lib_tuple_like // >= C++23 > > > > + template<__eligible_tuple_like _UTuple> > > > > + requires (__constructible_from_tuple_like<_UTuple>()) > > > > + && (!__use_other_ctor<_UTuple>()) > > > > + constexpr explicit(!__convertible_from_tuple_like<_UTuple>()) > > > > + tuple(_UTuple&& __u) > > > > + : _Inherited(__tuple_like_tag_t{}, > > > > + std::forward<_UTuple>(__u), > > > > + make_index_sequence{}) > > > > + { } > > > > #endif // C++23 > > > > > > > > // Allocator-extended constructors. > > > > @@ -1202,10 +1308,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > > > tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&&) = delete; > > > > #endif // C++23 > > > > > > > > -#if 0 && __cpp_lib_tuple_like // >= C++23 > > > > - template > > > > - constexpr explicit(...) > > > > - tuple(allocator_arg_t __tag, const _Alloc& __a, _UTuple&& __u); > > > > +#if __cpp_lib_tuple_like // >= C++23 > > > > + template _UTuple> > > > > + requires (__constructible_from_tuple_like<_UTuple>()) > > > > + && (!__use_other_ctor<_UTuple>()) > > > > + constexpr explicit(!__convertible_from_tuple_like<_UTuple>()) > > > > + tuple(allocator_arg_t __tag, const _Alloc& __a, _UTuple&& __u) > > > > + : _Inherited(__tuple_like_tag_t{}, > > > > + __tag, __a, std::forward<_UTuple>(__u), > > > > + make_index_sequence{}) > > > > + { } > > > > #endif // C++23 > > > > > > For some reason these two new constructors aren't deleted if they > > > create dangling refs. I don't know why. > > > > Hmm, seems like an oversight. Shall we proactively implement them? > > Yes, I think so. I can't see why we would want to permit a dangling > reference there. > > e.g. > std::array a{}; > std::tuple t(a); This is now https://cplusplus.github.io/LWG/issue4045