summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/coroutines.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/coroutines.cpp')
-rw-r--r--clang/test/SemaCXX/coroutines.cpp63
1 files changed, 6 insertions, 57 deletions
diff --git a/clang/test/SemaCXX/coroutines.cpp b/clang/test/SemaCXX/coroutines.cpp
index 99964ef6bcb..5e1ff34c403 100644
--- a/clang/test/SemaCXX/coroutines.cpp
+++ b/clang/test/SemaCXX/coroutines.cpp
@@ -314,23 +314,13 @@ struct CtorDtor {
}
};
-namespace std { class type_info; }
-
void unevaluated() {
- decltype(co_await a); // expected-error {{'co_await' cannot be used in an unevaluated context}}
- // expected-warning@-1 {{declaration does not declare anything}}
- sizeof(co_await a); // expected-error {{'co_await' cannot be used in an unevaluated context}}
- // expected-error@-1 {{invalid application of 'sizeof' to an incomplete type 'void'}}
- typeid(co_await a); // expected-error {{'co_await' cannot be used in an unevaluated context}}
- // expected-warning@-1 {{expression with side effects has no effect in an unevaluated context}}
- // expected-warning@-2 {{expression result unused}}
- decltype(co_yield 1); // expected-error {{'co_yield' cannot be used in an unevaluated context}}
- // expected-warning@-1 {{declaration does not declare anything}}
- sizeof(co_yield 2); // expected-error {{'co_yield' cannot be used in an unevaluated context}}
- // expected-error@-1 {{invalid application of 'sizeof' to an incomplete type 'void'}}
- typeid(co_yield 3); // expected-error {{'co_yield' cannot be used in an unevaluated context}}
- // expected-warning@-1 {{expression with side effects has no effect in an unevaluated context}}
- // expected-warning@-2 {{expression result unused}}
+ decltype(co_await a); // expected-error {{cannot be used in an unevaluated context}}
+ sizeof(co_await a); // expected-error {{cannot be used in an unevaluated context}}
+ typeid(co_await a); // expected-error {{cannot be used in an unevaluated context}}
+ decltype(co_yield a); // expected-error {{cannot be used in an unevaluated context}}
+ sizeof(co_yield a); // expected-error {{cannot be used in an unevaluated context}}
+ typeid(co_yield a); // expected-error {{cannot be used in an unevaluated context}}
}
// [expr.await]p2: "An await-expression shall not appear in a default argument."
@@ -338,47 +328,6 @@ void unevaluated() {
// not allowed. A user may not understand that this is "outside a function."
void default_argument(int arg = co_await 0) {} // expected-error {{'co_await' cannot be used outside a function}}
-void await_in_catch_coroutine() {
- try {
- } catch (...) { // FIXME: Emit a note diagnostic pointing out the try handler on this line.
- []() -> void { co_await a; }(); // OK
- co_await a; // expected-error {{'co_await' cannot be used in the handler of a try block}}
- }
-}
-
-void await_nested_in_catch_coroutine() {
- try {
- } catch (...) { // FIXME: Emit a note diagnostic pointing out the try handler on this line.
- try {
- co_await a; // expected-error {{'co_await' cannot be used in the handler of a try block}}
- []() -> void { co_await a; }(); // OK
- } catch (...) {
- co_return 123;
- }
- }
-}
-
-void await_in_lambda_in_catch_coroutine() {
- try {
- } catch (...) {
- []() -> void { co_await a; }(); // OK
- }
-}
-
-void yield_in_catch_coroutine() {
- try {
- } catch (...) {
- co_yield 1; // expected-error {{'co_yield' cannot be used in the handler of a try block}}
- }
-}
-
-void return_in_catch_coroutine() {
- try {
- } catch (...) {
- co_return 123; // OK
- }
-}
-
constexpr auto constexpr_deduced_return_coroutine() {
co_yield 0; // expected-error {{'co_yield' cannot be used in a constexpr function}}
// expected-error@-1 {{'co_yield' cannot be used in a function with a deduced return type}}
OpenPOWER on IntegriCloud