Gor Nishanov | 4ffb434 | 2016-10-02 03:31:58 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++14 -fcoroutines-ts -verify %s |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 2 | |
Eric Fiselier | a546528 | 2016-09-29 21:47:39 +0000 | [diff] [blame] | 3 | void no_coroutine_traits_bad_arg_await() { |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 4 | co_await a; // expected-error {{include <experimental/coroutine>}} |
Eric Fiselier | a546528 | 2016-09-29 21:47:39 +0000 | [diff] [blame] | 5 | // expected-error@-1 {{use of undeclared identifier 'a'}} |
| 6 | } |
| 7 | |
| 8 | void no_coroutine_traits_bad_arg_yield() { |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 9 | co_yield a; // expected-error {{include <experimental/coroutine>}} |
Eric Fiselier | a546528 | 2016-09-29 21:47:39 +0000 | [diff] [blame] | 10 | // expected-error@-1 {{use of undeclared identifier 'a'}} |
| 11 | } |
| 12 | |
| 13 | |
| 14 | void no_coroutine_traits_bad_arg_return() { |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 15 | co_return a; // expected-error {{include <experimental/coroutine>}} |
Eric Fiselier | a546528 | 2016-09-29 21:47:39 +0000 | [diff] [blame] | 16 | // expected-error@-1 {{use of undeclared identifier 'a'}} |
| 17 | } |
| 18 | |
| 19 | |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 20 | struct awaitable { |
| 21 | bool await_ready(); |
| 22 | void await_suspend(); // FIXME: coroutine_handle |
| 23 | void await_resume(); |
| 24 | } a; |
| 25 | |
Richard Smith | 2af65c4 | 2015-11-24 02:34:39 +0000 | [diff] [blame] | 26 | struct suspend_always { |
| 27 | bool await_ready() { return false; } |
| 28 | void await_suspend() {} |
| 29 | void await_resume() {} |
| 30 | }; |
| 31 | |
| 32 | struct suspend_never { |
| 33 | bool await_ready() { return true; } |
| 34 | void await_suspend() {} |
| 35 | void await_resume() {} |
| 36 | }; |
| 37 | |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 38 | void no_coroutine_traits() { |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 39 | co_await a; // expected-error {{need to include <experimental/coroutine>}} |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | namespace std { |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 43 | namespace experimental { |
| 44 | template <typename... T> |
| 45 | struct coroutine_traits; // expected-note {{declared here}} |
| 46 | } |
| 47 | } |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 48 | |
Richard Smith | 2af65c4 | 2015-11-24 02:34:39 +0000 | [diff] [blame] | 49 | template<typename Promise> struct coro {}; |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 50 | template <typename Promise, typename... Ps> |
| 51 | struct std::experimental::coroutine_traits<coro<Promise>, Ps...> { |
Richard Smith | 2af65c4 | 2015-11-24 02:34:39 +0000 | [diff] [blame] | 52 | using promise_type = Promise; |
| 53 | }; |
| 54 | |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 55 | void no_specialization() { |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 56 | co_await a; // expected-error {{implicit instantiation of undefined template 'std::experimental::coroutine_traits<void>'}} |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 57 | } |
| 58 | |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 59 | template <typename... T> |
| 60 | struct std::experimental::coroutine_traits<int, T...> {}; |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 61 | |
| 62 | int no_promise_type() { |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 63 | co_await a; // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits<int>' has no member named 'promise_type'}} |
Richard Smith | 9b2f53e | 2015-11-19 02:36:35 +0000 | [diff] [blame] | 64 | } |
| 65 | |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 66 | template <> |
| 67 | struct std::experimental::coroutine_traits<double, double> { typedef int promise_type; }; |
Richard Smith | 9b2f53e | 2015-11-19 02:36:35 +0000 | [diff] [blame] | 68 | double bad_promise_type(double) { |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 69 | co_await a; // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits<double, double>::promise_type' (aka 'int') is not a class}} |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 70 | } |
| 71 | |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 72 | template <> |
| 73 | struct std::experimental::coroutine_traits<double, int> { |
Richard Smith | 23da82c | 2015-11-20 22:40:06 +0000 | [diff] [blame] | 74 | struct promise_type {}; |
| 75 | }; |
| 76 | double bad_promise_type_2(int) { |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 77 | co_yield 0; // expected-error {{no member named 'yield_value' in 'std::experimental::coroutine_traits<double, int>::promise_type'}} |
Richard Smith | 23da82c | 2015-11-20 22:40:06 +0000 | [diff] [blame] | 78 | } |
| 79 | |
Richard Smith | 2af65c4 | 2015-11-24 02:34:39 +0000 | [diff] [blame] | 80 | struct promise; // expected-note 2{{forward declaration}} |
Eric Fiselier | 9813131 | 2016-10-06 21:23:38 +0000 | [diff] [blame^] | 81 | struct promise_void; |
| 82 | struct void_tag {}; |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 83 | template <typename... T> |
| 84 | struct std::experimental::coroutine_traits<void, T...> { using promise_type = promise; }; |
Eric Fiselier | 9813131 | 2016-10-06 21:23:38 +0000 | [diff] [blame^] | 85 | template <typename... T> |
| 86 | struct std::experimental::coroutine_traits<void, void_tag, T...> |
| 87 | { using promise_type = promise_void; }; |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 88 | |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 89 | namespace std { |
| 90 | namespace experimental { |
| 91 | template <typename Promise = void> |
| 92 | struct coroutine_handle; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | // FIXME: This diagnostic is terrible. |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 97 | void undefined_promise() { // expected-error {{variable has incomplete type 'promise_type'}} |
Richard Smith | 2af65c4 | 2015-11-24 02:34:39 +0000 | [diff] [blame] | 98 | // FIXME: This diagnostic doesn't make any sense. |
| 99 | // expected-error@-2 {{incomplete definition of type 'promise'}} |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 100 | co_await a; |
| 101 | } |
| 102 | |
Richard Smith | ae3d147 | 2015-11-20 22:47:10 +0000 | [diff] [blame] | 103 | struct yielded_thing { const char *p; short a, b; }; |
Richard Smith | 23da82c | 2015-11-20 22:40:06 +0000 | [diff] [blame] | 104 | |
Richard Smith | d7bed4d | 2015-11-22 02:57:17 +0000 | [diff] [blame] | 105 | struct not_awaitable {}; |
| 106 | |
Richard Smith | 23da82c | 2015-11-20 22:40:06 +0000 | [diff] [blame] | 107 | struct promise { |
Richard Smith | 2af65c4 | 2015-11-24 02:34:39 +0000 | [diff] [blame] | 108 | void get_return_object(); |
| 109 | suspend_always initial_suspend(); |
| 110 | suspend_always final_suspend(); |
Richard Smith | 71d403e | 2015-11-22 07:33:28 +0000 | [diff] [blame] | 111 | awaitable yield_value(int); // expected-note 2{{candidate}} |
| 112 | awaitable yield_value(yielded_thing); // expected-note 2{{candidate}} |
| 113 | not_awaitable yield_value(void()); // expected-note 2{{candidate}} |
Richard Smith | 71d403e | 2015-11-22 07:33:28 +0000 | [diff] [blame] | 114 | void return_value(int); // expected-note 2{{here}} |
Richard Smith | 23da82c | 2015-11-20 22:40:06 +0000 | [diff] [blame] | 115 | }; |
| 116 | |
Eric Fiselier | 9813131 | 2016-10-06 21:23:38 +0000 | [diff] [blame^] | 117 | struct promise_void { |
| 118 | void get_return_object(); |
| 119 | suspend_always initial_suspend(); |
| 120 | suspend_always final_suspend(); |
| 121 | awaitable yield_value(int); |
| 122 | awaitable yield_value(yielded_thing); |
| 123 | not_awaitable yield_value(void()); |
| 124 | void return_void(); |
| 125 | }; |
| 126 | |
Richard Smith | 23da82c | 2015-11-20 22:40:06 +0000 | [diff] [blame] | 127 | void yield() { |
| 128 | co_yield 0; |
Richard Smith | ae3d147 | 2015-11-20 22:47:10 +0000 | [diff] [blame] | 129 | co_yield {"foo", 1, 2}; |
| 130 | co_yield {1e100}; // expected-error {{cannot be narrowed}} expected-note {{explicit cast}} expected-warning {{changes value}} expected-warning {{braces around scalar}} |
| 131 | co_yield {"foo", __LONG_LONG_MAX__}; // expected-error {{cannot be narrowed}} expected-note {{explicit cast}} expected-warning {{changes value}} |
| 132 | co_yield {"foo"}; |
Richard Smith | 23da82c | 2015-11-20 22:40:06 +0000 | [diff] [blame] | 133 | co_yield "foo"; // expected-error {{no matching}} |
Richard Smith | d7bed4d | 2015-11-22 02:57:17 +0000 | [diff] [blame] | 134 | co_yield 1.0; |
| 135 | co_yield yield; // expected-error {{no member named 'await_ready' in 'not_awaitable'}} |
Richard Smith | 23da82c | 2015-11-20 22:40:06 +0000 | [diff] [blame] | 136 | } |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 137 | |
Richard Smith | 4ba6660 | 2015-11-22 07:05:16 +0000 | [diff] [blame] | 138 | void coreturn(int n) { |
| 139 | co_await a; |
| 140 | if (n == 0) |
| 141 | co_return 3; |
| 142 | if (n == 1) |
Eric Fiselier | 9813131 | 2016-10-06 21:23:38 +0000 | [diff] [blame^] | 143 | co_return {4}; // expected-warning {{braces around scalar initializer}} |
Richard Smith | 4ba6660 | 2015-11-22 07:05:16 +0000 | [diff] [blame] | 144 | if (n == 2) |
| 145 | co_return "foo"; // expected-error {{cannot initialize a parameter of type 'int' with an lvalue of type 'const char [4]'}} |
Eric Fiselier | 9813131 | 2016-10-06 21:23:38 +0000 | [diff] [blame^] | 146 | co_return 42; |
Richard Smith | 4ba6660 | 2015-11-22 07:05:16 +0000 | [diff] [blame] | 147 | } |
| 148 | |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 149 | void mixed_yield() { |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 150 | co_yield 0; // expected-note {{use of 'co_yield'}} |
| 151 | return; // expected-error {{not allowed in coroutine}} |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | void mixed_await() { |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 155 | co_await a; // expected-note {{use of 'co_await'}} |
| 156 | return; // expected-error {{not allowed in coroutine}} |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 157 | } |
| 158 | |
Eric Fiselier | 9813131 | 2016-10-06 21:23:38 +0000 | [diff] [blame^] | 159 | void only_coreturn(void_tag) { |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 160 | co_return; // expected-warning {{'co_return' used in a function that uses neither 'co_await' nor 'co_yield'}} |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 161 | } |
| 162 | |
Eric Fiselier | 9813131 | 2016-10-06 21:23:38 +0000 | [diff] [blame^] | 163 | void mixed_coreturn(void_tag, bool b) { |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 164 | if (b) |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 165 | // expected-warning@+1 {{'co_return' used in a function that uses neither}} |
| 166 | co_return; // expected-note {{use of 'co_return'}} |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 167 | else |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 168 | return; // expected-error {{not allowed in coroutine}} |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | struct CtorDtor { |
| 172 | CtorDtor() { |
| 173 | co_yield 0; // expected-error {{'co_yield' cannot be used in a constructor}} |
| 174 | } |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 175 | CtorDtor(awaitable a) { |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 176 | // The spec doesn't say this is ill-formed, but it must be. |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 177 | co_await a; // expected-error {{'co_await' cannot be used in a constructor}} |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 178 | } |
| 179 | ~CtorDtor() { |
| 180 | co_return 0; // expected-error {{'co_return' cannot be used in a destructor}} |
| 181 | } |
| 182 | // FIXME: The spec says this is ill-formed. |
| 183 | void operator=(CtorDtor&) { |
| 184 | co_yield 0; |
| 185 | } |
| 186 | }; |
| 187 | |
Richard Smith | 744b224 | 2015-11-20 02:54:01 +0000 | [diff] [blame] | 188 | void unevaluated() { |
| 189 | decltype(co_await a); // expected-error {{cannot be used in an unevaluated context}} |
| 190 | sizeof(co_await a); // expected-error {{cannot be used in an unevaluated context}} |
| 191 | typeid(co_await a); // expected-error {{cannot be used in an unevaluated context}} |
| 192 | decltype(co_yield a); // expected-error {{cannot be used in an unevaluated context}} |
| 193 | sizeof(co_yield a); // expected-error {{cannot be used in an unevaluated context}} |
| 194 | typeid(co_yield a); // expected-error {{cannot be used in an unevaluated context}} |
| 195 | } |
| 196 | |
| 197 | constexpr void constexpr_coroutine() { |
| 198 | co_yield 0; // expected-error {{'co_yield' cannot be used in a constexpr function}} |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | void varargs_coroutine(const char *, ...) { |
Richard Smith | 9f690bd | 2015-10-27 06:02:45 +0000 | [diff] [blame] | 202 | co_await a; // expected-error {{'co_await' cannot be used in a varargs function}} |
| 203 | } |
| 204 | |
| 205 | struct outer {}; |
| 206 | |
| 207 | namespace dependent_operator_co_await_lookup { |
| 208 | template<typename T> void await_template(T t) { |
| 209 | // no unqualified lookup results |
| 210 | co_await t; // expected-error {{no member named 'await_ready' in 'dependent_operator_co_await_lookup::not_awaitable'}} |
| 211 | // expected-error@-1 {{call to function 'operator co_await' that is neither visible in the template definition nor found by argument-dependent lookup}} |
| 212 | }; |
| 213 | template void await_template(awaitable); |
| 214 | |
| 215 | struct indirectly_awaitable { indirectly_awaitable(outer); }; |
| 216 | awaitable operator co_await(indirectly_awaitable); // expected-note {{should be declared prior to}} |
| 217 | template void await_template(indirectly_awaitable); |
| 218 | |
| 219 | struct not_awaitable {}; |
| 220 | template void await_template(not_awaitable); // expected-note {{instantiation}} |
| 221 | |
| 222 | template<typename T> void await_template_2(T t) { |
| 223 | // one unqualified lookup result |
| 224 | co_await t; |
| 225 | }; |
| 226 | template void await_template(outer); // expected-note {{instantiation}} |
| 227 | template void await_template_2(outer); |
Richard Smith | cfd53b4 | 2015-10-22 06:13:50 +0000 | [diff] [blame] | 228 | } |
Richard Smith | 10610f7 | 2015-11-20 22:57:24 +0000 | [diff] [blame] | 229 | |
Richard Smith | 71d403e | 2015-11-22 07:33:28 +0000 | [diff] [blame] | 230 | struct yield_fn_tag {}; |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 231 | template <> |
| 232 | struct std::experimental::coroutine_traits<void, yield_fn_tag> { |
Richard Smith | 71d403e | 2015-11-22 07:33:28 +0000 | [diff] [blame] | 233 | struct promise_type { |
| 234 | // FIXME: add an await_transform overload for functions |
| 235 | awaitable yield_value(int()); |
| 236 | void return_value(int()); |
Richard Smith | 2af65c4 | 2015-11-24 02:34:39 +0000 | [diff] [blame] | 237 | |
| 238 | suspend_never initial_suspend(); |
| 239 | suspend_never final_suspend(); |
| 240 | void get_return_object(); |
Richard Smith | 71d403e | 2015-11-22 07:33:28 +0000 | [diff] [blame] | 241 | }; |
| 242 | }; |
| 243 | |
Richard Smith | 10610f7 | 2015-11-20 22:57:24 +0000 | [diff] [blame] | 244 | namespace placeholder { |
Richard Smith | 71d403e | 2015-11-22 07:33:28 +0000 | [diff] [blame] | 245 | awaitable f(), f(int); // expected-note 4{{possible target}} |
| 246 | int g(), g(int); // expected-note 2{{candidate}} |
Richard Smith | 10610f7 | 2015-11-20 22:57:24 +0000 | [diff] [blame] | 247 | void x() { |
| 248 | co_await f; // expected-error {{reference to overloaded function}} |
| 249 | } |
| 250 | void y() { |
Richard Smith | 71d403e | 2015-11-22 07:33:28 +0000 | [diff] [blame] | 251 | co_yield g; // expected-error {{no matching member function for call to 'yield_value'}} |
Richard Smith | 10610f7 | 2015-11-20 22:57:24 +0000 | [diff] [blame] | 252 | } |
| 253 | void z() { |
| 254 | co_await a; |
Richard Smith | 71d403e | 2015-11-22 07:33:28 +0000 | [diff] [blame] | 255 | co_return g; // expected-error {{address of overloaded function 'g' does not match required type 'int'}} |
| 256 | } |
| 257 | |
| 258 | void x(yield_fn_tag) { |
| 259 | co_await f; // expected-error {{reference to overloaded function}} |
| 260 | } |
| 261 | void y(yield_fn_tag) { |
| 262 | co_yield g; |
| 263 | } |
| 264 | void z(yield_fn_tag) { |
| 265 | co_await a; |
| 266 | co_return g; |
Richard Smith | 10610f7 | 2015-11-20 22:57:24 +0000 | [diff] [blame] | 267 | } |
| 268 | } |
Richard Smith | 2af65c4 | 2015-11-24 02:34:39 +0000 | [diff] [blame] | 269 | |
| 270 | struct bad_promise_1 { |
| 271 | suspend_always initial_suspend(); |
| 272 | suspend_always final_suspend(); |
| 273 | }; |
| 274 | coro<bad_promise_1> missing_get_return_object() { // expected-error {{no member named 'get_return_object' in 'bad_promise_1'}} |
| 275 | co_await a; |
| 276 | } |
| 277 | |
| 278 | struct bad_promise_2 { |
| 279 | coro<bad_promise_2> get_return_object(); |
| 280 | // FIXME: We shouldn't offer a typo-correction here! |
| 281 | suspend_always final_suspend(); // expected-note {{here}} |
| 282 | }; |
| 283 | coro<bad_promise_2> missing_initial_suspend() { // expected-error {{no member named 'initial_suspend' in 'bad_promise_2'}} |
| 284 | co_await a; |
| 285 | } |
| 286 | |
| 287 | struct bad_promise_3 { |
| 288 | coro<bad_promise_3> get_return_object(); |
| 289 | // FIXME: We shouldn't offer a typo-correction here! |
| 290 | suspend_always initial_suspend(); // expected-note {{here}} |
| 291 | }; |
| 292 | coro<bad_promise_3> missing_final_suspend() { // expected-error {{no member named 'final_suspend' in 'bad_promise_3'}} |
| 293 | co_await a; |
| 294 | } |
| 295 | |
| 296 | struct bad_promise_4 { |
| 297 | coro<bad_promise_4> get_return_object(); |
| 298 | not_awaitable initial_suspend(); |
| 299 | suspend_always final_suspend(); |
| 300 | }; |
| 301 | // FIXME: This diagnostic is terrible. |
| 302 | coro<bad_promise_4> bad_initial_suspend() { // expected-error {{no member named 'await_ready' in 'not_awaitable'}} |
| 303 | co_await a; |
| 304 | } |
| 305 | |
| 306 | struct bad_promise_5 { |
| 307 | coro<bad_promise_5> get_return_object(); |
| 308 | suspend_always initial_suspend(); |
| 309 | not_awaitable final_suspend(); |
| 310 | }; |
| 311 | // FIXME: This diagnostic is terrible. |
| 312 | coro<bad_promise_5> bad_final_suspend() { // expected-error {{no member named 'await_ready' in 'not_awaitable'}} |
| 313 | co_await a; |
| 314 | } |
Eric Fiselier | 7d5773e | 2016-09-30 22:38:31 +0000 | [diff] [blame] | 315 | |
| 316 | |
Gor Nishanov | 3e048bb | 2016-10-04 00:31:16 +0000 | [diff] [blame] | 317 | template<> struct std::experimental::coroutine_traits<int, int, const char**> |
Eric Fiselier | 7d5773e | 2016-09-30 22:38:31 +0000 | [diff] [blame] | 318 | { using promise_type = promise; }; |
| 319 | |
| 320 | int main(int, const char**) { // expected-error {{'main' cannot be a coroutine}} |
| 321 | co_await a; // expected-note {{function is a coroutine due to use of 'co_await' here}} |
| 322 | } |