summaryrefslogtreecommitdiff
path: root/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/coroutine-unhandled_exception-warning.cpp')
-rw-r--r--test/SemaCXX/coroutine-unhandled_exception-warning.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/SemaCXX/coroutine-unhandled_exception-warning.cpp b/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
index f98e00d1a7092..d7f6066109a5f 100644
--- a/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
+++ b/test/SemaCXX/coroutine-unhandled_exception-warning.cpp
@@ -1,4 +1,11 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify -fblocks -Wno-unreachable-code -Wno-unused-value
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts \
+// RUN: -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify \
+// RUN: -fblocks -Wno-unreachable-code -Wno-unused-value
+
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts \
+// RUN: -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify \
+// RUN: -fblocks -Wno-unreachable-code -Wno-unused-value \
+// RUN: -DDISABLE_WARNING -Wno-coroutine-missing-unhandled-exception
#if __has_feature(cxx_exceptions)
#error This test requires exceptions be disabled
@@ -19,6 +26,12 @@ struct promise_void {
template <typename... T>
struct std::experimental::coroutine_traits<void, T...> { using promise_type = promise_void; };
+#ifndef DISABLE_WARNING
void test0() { // expected-warning {{'promise_void' is required to declare the member 'unhandled_exception()' when exceptions are enabled}}
co_return;
}
+#else
+void test0() { // expected-no-diagnostics
+ co_return;
+}
+#endif