1 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts \
2 // RUN:    -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify \
3 // RUN:    -fblocks -Wno-unreachable-code -Wno-unused-value
4 
5 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts \
6 // RUN:    -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify \
7 // RUN:    -fblocks -Wno-unreachable-code -Wno-unused-value \
8 // RUN:    -DDISABLE_WARNING -Wno-coroutine-missing-unhandled-exception
9 
10 #if __has_feature(cxx_exceptions)
11 #error This test requires exceptions be disabled
12 #endif
13 
14 #include "Inputs/std-coroutine.h"
15 
16 using std::experimental::suspend_always;
17 using std::experimental::suspend_never;
18 
19 struct promise_void {
20   void get_return_object();
21   suspend_always initial_suspend();
22   suspend_always final_suspend();
23   void return_void();
24 };
25 
26 template <typename... T>
27 struct std::experimental::coroutine_traits<void, T...> { using promise_type = promise_void; };
28 
29 #ifndef DISABLE_WARNING
30 void test0() { // expected-warning {{'promise_void' is required to declare the member 'unhandled_exception()' when exceptions are enabled}}
31   co_return;
32 }
33 #else
34 void test0() { // expected-no-diagnostics
35   co_return;
36 }
37 #endif
38