[coroutines] Build implicit return_value / return_void calls for co_return.
llvm-svn: 253816
diff --git a/clang/test/SemaCXX/coroutines.cpp b/clang/test/SemaCXX/coroutines.cpp
index d5968fc..85cc919 100644
--- a/clang/test/SemaCXX/coroutines.cpp
+++ b/clang/test/SemaCXX/coroutines.cpp
@@ -52,6 +52,8 @@
awaitable yield_value(int); // expected-note {{candidate}}
awaitable yield_value(yielded_thing); // expected-note {{candidate}}
not_awaitable yield_value(void()); // expected-note {{candidate}}
+ void return_void();
+ void return_value(int); // expected-note {{here}}
};
void yield() {
@@ -65,6 +67,17 @@
co_yield yield; // expected-error {{no member named 'await_ready' in 'not_awaitable'}}
}
+void coreturn(int n) {
+ co_await a;
+ if (n == 0)
+ co_return 3;
+ if (n == 1)
+ co_return {4};
+ if (n == 2)
+ co_return "foo"; // expected-error {{cannot initialize a parameter of type 'int' with an lvalue of type 'const char [4]'}}
+ co_return;
+}
+
void mixed_yield() {
co_yield 0; // expected-note {{use of 'co_yield'}}
return; // expected-error {{not allowed in coroutine}}