From patchwork Wed Oct 12 19:38:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 1968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp2774118wrs; Wed, 12 Oct 2022 12:39:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6A2AEDteNCxcv3O6sRIKCcP2EX+a8lPgZtgqoly9gc+TdN+FOiHg5jdbOAcyhyUjNjrwDu X-Received: by 2002:a05:6402:1587:b0:458:fbea:436c with SMTP id c7-20020a056402158700b00458fbea436cmr28811214edv.407.1665603588438; Wed, 12 Oct 2022 12:39:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665603588; cv=none; d=google.com; s=arc-20160816; b=cnHjVxrH4AuEu1Db8zJ64MzTC3+8REaXr2j+nuQDoGcKWRjU/7W7wLmiQ/522Zl7ao RED1qscvVjnPIv/DCJ5fKb1WwtQ0TTwJgOhwwwDPfFcXhrMrFiPjQe4tojeNBXTORpQd znsT2+mxVMKrrwefOMf38Eq+haD2VFZQ2jWc3VKmWrcgl1IqC4Ax2uirK9lhBOjypk9k PLeqIgfGHRF33KrafENFuBhPB9phe7pxzjb5LnbYXRfKmQsjS6PLw+OIcPyDHdGDPPir 7J6Y7BK2WYtt5ferxXuN4cMSmDIiIG6hmixLdCChJstWIm3DEp52DL7ritbVut6t1w3c uWpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:user-agent:mime-version:message-id:subject:to :date:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=TGIF4gKIVuBMTDYkFOm5NrKTsQojOXfWhnvxrjSsTug=; b=XCmC401cKooeOcfi5v/Wy8S39exus43WglYe4bx8HlyO+bXqJWXQNLvbmZkUWRy2F+ c2cCIn+j4dM7V6ZkWNnGbNbOZ1p3dTuPbThXC/u2YAagVN3VLfp9HJi93hsxBChrg1Tm Aaa8Ve3T+p+W5GOSo2S47y2rJ6OgZvCpff7hb0SlyXZCO9KqQaW/EWVICymdnkAuZoGR sPrCdVFzEynH32n3DHfFpNO9A6TWOJHGIK5WSwENx4qanVIAltUSCFWLPa/rXb26CKWW tgO8Y5/vruvEr1P/QpFNlgyX8rK+C5Uipf50MiCFbp+yyKelOExUV2v+6gp9H0FAtJVB 59fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=srSYdPpB; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id w12-20020a05640234cc00b0045cc02ce2aasi1445102edc.319.2022.10.12.12.39.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 12:39:48 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=srSYdPpB; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 426CC3860748 for ; Wed, 12 Oct 2022 19:39:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 426CC3860748 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665603587; bh=TGIF4gKIVuBMTDYkFOm5NrKTsQojOXfWhnvxrjSsTug=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=srSYdPpBf2s3o/TESEfBn0v7NtqNudzweoIJDHZh5bSTv5yLPOi+mUn84L5Pu8OX5 hrCGThI7FXBhg0ivvd84jWcjz27EcTgFyLT1q6rh+vAGdLcr/PitBApf3NV37Er7La kEf/TXzz6npmVXPPlYUti0q9PMj7bOvgcr+z5Reo= 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 234BB3858290 for ; Wed, 12 Oct 2022 19:39:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 234BB3858290 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-356-3G2B45V8Ol-gVfN3oWwfkA-1; Wed, 12 Oct 2022 15:39:03 -0400 X-MC-Unique: 3G2B45V8Ol-gVfN3oWwfkA-1 Received: by mail-qv1-f70.google.com with SMTP id y2-20020a0ce802000000b004b1ce1c4a70so10288404qvn.9 for ; Wed, 12 Oct 2022 12:39:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TGIF4gKIVuBMTDYkFOm5NrKTsQojOXfWhnvxrjSsTug=; b=O3Scs+aXfAjSwr2RgH57CBXlhsI305begGml5yxCpFSvPnTS2787SFlBzvQVgUrnnn bNh1trZS953w6CIsnOLOjKDmFk2kK6no5e3UCl6vB2fMT2kwr241HUOwo1TraYz9B/Zo qCT1N5XUU+rFGyHRPkKQmyB6qkdsFJXHHPWAn4F4AdhYfymaUoGtZyNI987GfHZ261lv BYDbw839DFerJSYLYNaBEQNLz/lu2IVTB7iZjqqJvjZ8khylE+VlSYn2mYxsmZiAFnCj 27lnmxHoLKZUJNJKRPF9+PFXkxexbmXdomaIh8psuE+gzEHxGIvzg9eNst0JAyZR9mMD OW3A== X-Gm-Message-State: ACrzQf2NUrqXjV+yopnnMjdRaiOljaMSZzUH+zk/z7VP5AZ17qa2D+64 l6h+UbB2ET5sIw+euHYjq5yYcEh/2N9y7vArDWnHRsQ2xA10PAE8F3YOMaoTuXQrXnVMioDiGbM sBloLnrWejqMGwpIuoxEh4Kp8e+ClkVZC23Wqdj1iufO8UpiH+bYcNPpHQonAf+OrLKia X-Received: by 2002:a05:620a:1923:b0:6ed:4c4d:78b5 with SMTP id bj35-20020a05620a192300b006ed4c4d78b5mr10724701qkb.97.1665603542143; Wed, 12 Oct 2022 12:39:02 -0700 (PDT) X-Received: by 2002:a05:620a:1923:b0:6ed:4c4d:78b5 with SMTP id bj35-20020a05620a192300b006ed4c4d78b5mr10724682qkb.97.1665603541854; Wed, 12 Oct 2022 12:39:01 -0700 (PDT) Received: from redhat.com (2603-7000-9500-2e39-0000-0000-0000-1db4.res6.spectrum.com. [2603:7000:9500:2e39::1db4]) by smtp.gmail.com with ESMTPSA id s20-20020a05620a29d400b006eeb3165565sm82429qkp.80.2022.10.12.12.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 12:39:01 -0700 (PDT) Date: Wed, 12 Oct 2022 15:38:59 -0400 To: GCC Patches Subject: [wwwdocs] porting_to: Two-stage overload resolution for implicit move removed Message-ID: MIME-Version: 1.0 User-Agent: Mutt/2.2.7 (2022-08-07) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Marek Polacek via Gcc-patches From: Marek Polacek Reply-To: Marek Polacek Cc: Jonathan Wakely Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746511948244092690?= X-GMAIL-MSGID: =?utf-8?q?1746511948244092690?= As I promised in , I'd like to update our GCC 13 porting_to.html with the following note. Does this look OK to commit? Thanks, diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html index 84a00f21..243ed29d 100644 --- a/htdocs/gcc-13/porting_to.html +++ b/htdocs/gcc-13/porting_to.html @@ -42,5 +42,57 @@ be included explicitly when compiled with GCC 13: +

Two-stage overload resolution for implicit move removed

+

+GCC 13 removed the two-stage overload resolution when performing +implicit move, whereby the compiler does two separate overload resolutions: +one treating the operand as an rvalue, and then (if that resolution fails) +another one treating the operand as an lvalue. In the standard this was +introduced in C++11 and implemented in gcc in + +r251035. In + +r11-2412, the fallback overload resolution was disabled in C++20 (but +not in C++17). Then C++23 P2266 +removed the fallback overload resolution, and changed the implicit move +rules once again. +

+

+The two overload resolutions approach was complicated and quirky, so users +should transition to the newer model. This change means that code that +previously didn't compile in C++17 will now compile, for example:

+ +

+   struct S1 { S1(S1 &&); };
+   struct S2 : S1 {};
+
+   S1
+   f (S2 s)
+   {
+     return s; // OK, derived-to-base, use S1::S1(S1&&)
+   }
+
+ +

+And conversely, code that used to work in C++17 may not compile anymore: +

+ +

+   struct W {
+     W();
+   };
+
+   struct F {
+     F(W&);
+     F(W&&) = delete;
+   };
+
+   F fn ()
+   {
+     W w;
+     return w; // use w as rvalue -> use of deleted function F::F(W&&)
+   }
+
+