]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix tests broken by C++23 P2266R3 "Simpler implicit move"
authorJonathan Wakely <jwakely@redhat.com>
Mon, 3 Oct 2022 11:10:07 +0000 (12:10 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 3 Oct 2022 11:45:05 +0000 (12:45 +0100)
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.

libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/6.cc
libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc

index f62023c8c2ef615b6cdd584fde1ae5bfd26151e5..e45af3c02affa6a89306481461ceaf5d8bc43232 100644 (file)
@@ -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{};
 
index 6bbf4a7f341c1b3cdd9788f8aea3a687b0c19a55..7ef6442d358cdc570a5da12dd5b64c78cf9c5480 100644 (file)
@@ -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{};