public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Fix tests broken by C++23 P2266R3 "Simpler implicit move"
Date: Mon,  3 Oct 2022 12:46:41 +0100	[thread overview]
Message-ID: <20221003114641.367692-1-jwakely@redhat.com> (raw)

Tested x86_64-linux. Pushed to trunk.

-- >8 --

In C++23 mode these tests started to FAIL because an rvalue reference
parameter can no longer be bound to an lvalue reference return type. As
confirmed by Ville (who added these tests) the problem overloads are not
intended to be called, and only exist to verify that they don't
interfere with the intended behaviour. This changes the function bodies
to just throw, so that the tests will fail if the function is called.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_ostream/inserters_other/char/6.cc:
	Change body of unused operator<< overload to throw if called.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc:
	Likewise.
---
 .../testsuite/27_io/basic_ostream/inserters_other/char/6.cc     | 2 +-
 .../testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/6.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/6.cc
index f62023c8c2e..e45af3c02af 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/6.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/6.cc
@@ -42,7 +42,7 @@ std::ostream& operator<<(std::ostream&, const X&) = delete;
 
 struct Y {};
 std::ostream& operator<<(std::ostream& os, const Y&) {return os;}
-std::ostream& operator<<(std::ostream&& os, const Y&) {return os;}
+std::ostream& operator<<(std::ostream&& os, const Y&) {throw 1;} // not used
 
 struct Z{};
 
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc
index 6bbf4a7f341..7ef6442d358 100644
--- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc
@@ -42,7 +42,7 @@ std::wostream& operator<<(std::wostream&, const X&) = delete;
 
 struct Y {};
 std::wostream& operator<<(std::wostream& os, const Y&) {return os;}
-std::wostream& operator<<(std::wostream&& os, const Y&) {return os;}
+std::wostream& operator<<(std::wostream&& os, const Y&) {throw 1;} // not used
 
 struct Z{};
 
-- 
2.37.3


                 reply	other threads:[~2022-10-03 11:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221003114641.367692-1-jwakely@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).