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 234BB3858290 for ; Wed, 12 Oct 2022 19:39:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 234BB3858290 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665603543; 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; bh=TGIF4gKIVuBMTDYkFOm5NrKTsQojOXfWhnvxrjSsTug=; b=Tuc9QzFBjwvG29UPLVVpIZI96mdk29FzudE2TFrHy1Ico8MAZyDo5KC16JJd+D/MgWVLFO 2sfKfgrPOOmTUrP8RIzLHnNucA6VKo/aY27dZpRLuTQeXluTlGszkRTnPcTI4hZ0CBiOvz s5HU6WWeUFv2WvJdWzNhyBJe8xAIs3Y= 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-Google-Smtp-Source: AMsMyM6kcnaboxIP9xIBVsHjY1SkSeTE4cqVtCeV94sFqhaLGnzYOYe/JTv3BWCn8qFqPB9uHm2oag== 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 From: Marek Polacek To: GCC Patches Cc: Jason Merrill , Jonathan Wakely 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-Type: text/plain; charset=us-ascii 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 List-Id: 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&&)
+   }
+
+