]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Improve new testcase for std::optional assignment [PR117858]
authorJonathan Wakely <jwakely@redhat.com>
Sat, 30 Nov 2024 21:43:47 +0000 (21:43 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Sat, 30 Nov 2024 21:45:23 +0000 (21:45 +0000)
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.

libstdc++-v3/testsuite/20_util/optional/assignment/117858.cc

index 9443e16048467aff146ae959d3efa7cede9d00d4..e7045b37dd9c9a46433e2b9361e18a11e54cda73 100644 (file)
@@ -13,4 +13,5 @@ struct Focus
 void g(std::optional<Focus> f)
 {
   f = f;
+  f = std::move(f);
 }