summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/coroutines.cpp
diff options
context:
space:
mode:
authorBrian Gesiak <modocache@gmail.com>2019-03-22 16:08:29 +0000
committerBrian Gesiak <modocache@gmail.com>2019-03-22 16:08:29 +0000
commite8b3d63dd5bbd011306511a4ae1cdbd8e4915e5e (patch)
treeda2b81bd001eba70b8bdb601d3ce06263c24e0c0 /clang/test/SemaCXX/coroutines.cpp
parent4c2ef9a02be0562c48143b28bd239e8c42df6ce0 (diff)
downloadbcm5719-llvm-e8b3d63dd5bbd011306511a4ae1cdbd8e4915e5e.tar.gz
bcm5719-llvm-e8b3d63dd5bbd011306511a4ae1cdbd8e4915e5e.zip
Revert "[coroutines][PR40978] Emit error for co_yield within catch block"
The commit https://reviews.llvm.org/rC356296 is causing a regression in nested catch scopes, https://bugs.llvm.org/show_bug.cgi?id=41171. Revert this change for now in order to un-break that problem report. llvm-svn: 356774
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