| 1 |
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++20 \ |
| 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++20 \ |
| 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::suspend_always; |
| 17 |
using std::suspend_never; |
| 18 |
|
| 19 |
#ifndef DISABLE_WARNING |
| 20 |
struct promise_void { // expected-note {{defined here}} |
| 21 |
#else |
| 22 |
struct promise_void { |
| 23 |
#endif |
| 24 |
void get_return_object(); |
| 25 |
suspend_always initial_suspend(); |
| 26 |
suspend_always final_suspend() noexcept; |
| 27 |
void return_void(); |
| 28 |
}; |
| 29 |
|
| 30 |
template <typename... T> |
| 31 |
struct std::coroutine_traits<void, T...> { using promise_type = promise_void; }; |
| 32 |
|
| 33 |
#ifndef DISABLE_WARNING |
| 34 |
void test0() { // expected-warning {{'promise_void' is required to declare the member 'unhandled_exception()' when exceptions are enabled}} |
| 35 |
co_return; |
| 36 |
} |
| 37 |
#else |
| 38 |
void test0() { // expected-no-diagnostics |
| 39 |
co_return; |
| 40 |
} |
| 41 |
#endif |