https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120409
--- Comment #17 from Stian Halseth <stian at itx dot no> ---
> Adding the deleted copy constructor to the test makes it pass on
> sparc64 at all -O levels.
The change I tested, on master 1c6bee45b, sparc64-linux:
--- a/gcc/testsuite/g++.dg/coroutines/torture/pr119916.C
+++ b/gcc/testsuite/g++.dg/coroutines/torture/pr119916.C
@@ -50,6 +50,7 @@ struct OptionalPromiseReturn {
OptionalPromiseReturn(OptionalPromise &p) : pointer_{p.value_} {
pointer_ = &storage_;
}
+ OptionalPromiseReturn(const OptionalPromiseReturn &) = delete;
operator Optional() { return storage_; }
};
OptionalPromiseReturn OptionalPromise::get_return_object() {
make check-g++ RUNTESTFLAGS="coro-torture.exp=pr119916.C", before:
FAIL: g++.dg/coroutines/torture/pr119916.C -O0 execution test
FAIL: g++.dg/coroutines/torture/pr119916.C -O1 execution test
FAIL: g++.dg/coroutines/torture/pr119916.C -O2 execution test
FAIL: g++.dg/coroutines/torture/pr119916.C -O3 -g execution test
FAIL: g++.dg/coroutines/torture/pr119916.C -Os execution test
FAIL: g++.dg/coroutines/torture/pr119916.C -O2 -flto -fno-use-linker-plugin
-flto-partition=none execution test
FAIL: g++.dg/coroutines/torture/pr119916.C -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects execution test
and after:
PASS: g++.dg/coroutines/torture/pr119916.C -O0 execution test
PASS: g++.dg/coroutines/torture/pr119916.C -O1 execution test
PASS: g++.dg/coroutines/torture/pr119916.C -O2 execution test
PASS: g++.dg/coroutines/torture/pr119916.C -O3 -g execution test
PASS: g++.dg/coroutines/torture/pr119916.C -Os execution test
PASS: g++.dg/coroutines/torture/pr119916.C -O2 -flto -fno-use-linker-plugin
-flto-partition=none execution test
PASS: g++.dg/coroutines/torture/pr119916.C -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects execution test