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.133.124]) by sourceware.org (Postfix) with ESMTPS id 885FB385626E for ; Tue, 24 May 2022 10:23:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 885FB385626E Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-302-jMIKNNOcN3q9vUWsae2YvQ-1; Tue, 24 May 2022 06:23:02 -0400 X-MC-Unique: jMIKNNOcN3q9vUWsae2YvQ-1 Received: by mail-yb1-f199.google.com with SMTP id o7-20020a256b47000000b0064ddc3bea70so15418270ybm.4 for ; Tue, 24 May 2022 03:23:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Be3pmI780x8NMp1XTV80X0jGCEmNbcif5qPDPwFSI+w=; b=H/0yJLGjLNHS7PjAVwC8poKEqVMzhhPQCx479Q0FK3uUjmCjLDOuSE6pO56hmYNkD9 q4WHVP8pcQ/QMExlPLTZbF3GQBHTTrZ0LD5i5g+4s5SN7VPPP+6CueWaNTvN0qUuZTie eLgU/ST1WBTdp1uqOWzz4o3R4Padl/Hdqq23P41gzUS7BhlnYY2U0IxAik9cV8noAjo9 6jKVQbF1wwWAO+Q0Afi5qCe+Eu6lYWux8Yo49d2WnTnHRRwee/Pipl0ytzvYpiqnMu77 E/j9E5+7h3BoPLFS1ChHFL9NA9CRAuk8KiV3EAjQh0FUndpBZFLCn806fvFIXnsKm0ar C0Nw== X-Gm-Message-State: AOAM531Hwu3fjfG5lkrWO5psClrGGdQ1I6t2WAFTfF0GQyEUVFTRDSvm NILu+7wOj9F60mvL52lgzEGj0zzNubNr2yKKb+5ca9DBIgq9+jeE/eLZWjxkFg4mF1N6G8kGzvs zlSHbMZgVxNYPwROaj3RMPxA0L71lsxQ= X-Received: by 2002:a25:928b:0:b0:64d:9560:ecbb with SMTP id y11-20020a25928b000000b0064d9560ecbbmr24827209ybl.551.1653387781732; Tue, 24 May 2022 03:23:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3GRVswHe7yZUa30iRsO/GpY5/VmNRXGuQQK7pQZ70e8vCoEsWlF1yLU+5b3lmJEPt1zLJsUBbT0HPw9HMS90= X-Received: by 2002:a25:928b:0:b0:64d:9560:ecbb with SMTP id y11-20020a25928b000000b0064d9560ecbbmr24827198ybl.551.1653387781534; Tue, 24 May 2022 03:23:01 -0700 (PDT) MIME-Version: 1.0 References: <2fe3937d-1b9a-a547-bb41-225d3d5426a2@gmail.com> In-Reply-To: From: Jonathan Wakely Date: Tue, 24 May 2022 11:22:50 +0100 Message-ID: Subject: Re: [PATCH][_Hashtable] Fix insertion of range of type convertible to value_type PR 56112 To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++@gcc.gnu.org" , gcc-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2022 10:23:05 -0000 On Tue, 24 May 2022 at 11:18, Jonathan Wakely wrote: > > On Thu, 5 May 2022 at 18:38, Fran=C3=A7ois Dumont via Libstdc++ > wrote: > > > > Hi > > > > Renewing my patch to fix PR 56112 but for the insert methods, I totally > > change it, now works also with move-only key types. > > > > I let you Jonathan find a better name than _ValueTypeEnforcer as usual = :-) > > > > libstdc++: [_Hashtable] Insert range of types convertible to value_type > > PR 56112 > > > > Fix insertion of range of types convertible to value_type. Fix also whe= n > > this value_type > > has a move-only key_type which also allow converted values to be moved. > > > > libstdc++-v3/ChangeLog: > > > > PR libstdc++/56112 > > * include/bits/hashtable_policy.h (_ValueTypeEnforcer): New. > > * include/bits/hashtable.h > > (_Hashtable<>::_M_insert_unique_aux): New. > > (_Hashtable<>::_M_insert(_Arg&&, const _NodeGenerator&, > > true_type)): Use latters. > > (_Hashtable<>::_M_insert(_Arg&&, const _NodeGenerator&, > > false_type)): Likewise. > > (_Hashtable(_InputIterator, _InputIterator, size_type, const > > _Hash&, const _Equal&, > > const allocator_type&, true_type)): Use this.insert range. > > (_Hashtable(_InputIterator, _InputIterator, size_type, const > > _Hash&, const _Equal&, > > const allocator_type&, false_type)): Use _M_insert. > > * testsuite/23_containers/unordered_map/cons/56112.cc: Check > > how many times conversion > > is done. > > (test02): New test case. > > * testsuite/23_containers/unordered_set/cons/56112.cc: New tes= t. > > > > Tested under Linux x86_64. > > > > Ok to commit ? > > No, sorry. > > The new test02 function in 23_containers/unordered_map/cons/56112.cc > doesn't compile with libc++ or MSVC either, are you sure that test is > valid? I don't think it is, because S2 is not convertible to > pair. None of the pair constructors are > viable, because the move constructor would require two user-defined > conversions (from S2 to pair and then from > pair to pair). A conversion > sequence cannot have more than one user-defined conversion using a > constructor or converion operator. So if your patch makes that > compile, it's a bug in the new code. I haven't analyzed that code to > see where the problem is, I'm just looking at the test results and the > changes in behaviour. I meant to include this link showing that libc++ and MSVC reject test02() as well: https://godbolt.org/z/j7E9f6bd4 > > The new 23_containers/unordered_set/cons/56112.cc test fails for GCC > 11 but passes for GCC 12, even without your patch. Is it actually > testing some other change, not this patch, and not the 2013 fix for PR > 56112?