annotate gcc/testsuite/g++.dg/coroutines/pr9xxxx-mismatched-traits-and-promise-prev.C @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
1 // { dg-do compile { target c++17 } }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
2
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
3 #include "coro.h"
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
4
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
5 // Test that we get matching types to traits and promise param
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
6 // preview.
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
7
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
8 // A separate issue from allowing non-class return types.
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
9 struct Fake {} ;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
10
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
11 template<typename R, typename CallOp, typename ...T>
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
12 struct std::coroutine_traits<R, CallOp, T...> {
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
13 struct promise_type {
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
14 promise_type (CallOp op, T ...args) {}
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
15 Fake get_return_object() { return {}; }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
16 std::suspend_always initial_suspend() { return {}; }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
17 std::suspend_never final_suspend() { return {}; }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
18 void return_void() {}
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
19 void unhandled_exception() {}
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
20 };
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
21 };
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
22
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
23
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
24 struct Foo
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
25 {
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
26 Fake operator() (int a) {
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
27 co_return;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
28 }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
29 };