[committed] libstdc++: Improve new testcase for std::optional assignment [PR117858]

Jonathan Wakely jwakely@redhat.com
Sat Nov 30 21:45:42 GMT 2024


The copy & paste bug affected two assignment operators, so ensure the
new test covers both.

libstdc++-v3/ChangeLog:

	PR libstdc++/117858
	* testsuite/20_util/optional/assignment/117858.cc: Also test
	assignment from rvalue optional.
---

Tested x86_64-linux. Pushed to trunk.

 libstdc++-v3/testsuite/20_util/optional/assignment/117858.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libstdc++-v3/testsuite/20_util/optional/assignment/117858.cc b/libstdc++-v3/testsuite/20_util/optional/assignment/117858.cc
index 9443e160484..e7045b37dd9 100644
--- a/libstdc++-v3/testsuite/20_util/optional/assignment/117858.cc
+++ b/libstdc++-v3/testsuite/20_util/optional/assignment/117858.cc
@@ -13,4 +13,5 @@ struct Focus
 void g(std::optional<Focus> f)
 {
   f = f;
+  f = std::move(f);
 }
-- 
2.47.0



More information about the Libstdc++ mailing list