brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 5ea1e5d Raw
42 lines · cpp
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-value4 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-exception9 10#if __has_feature(cxx_exceptions)11#error This test requires exceptions be disabled12#endif13 14#include "Inputs/std-coroutine.h"15 16using std::suspend_always;17using std::suspend_never;18 19#ifndef DISABLE_WARNING20struct promise_void { // expected-note {{defined here}}21#else22struct promise_void {23#endif24  void get_return_object();25  suspend_always initial_suspend();26  suspend_always final_suspend() noexcept;27  void return_void();28};29 30template <typename... T>31struct std::coroutine_traits<void, T...> { using promise_type = promise_void; };32 33#ifndef DISABLE_WARNING34void test0() { // expected-warning {{'promise_void' is required to declare the member 'unhandled_exception()' when exceptions are enabled}}35  co_return;36}37#else38void test0() { // expected-no-diagnostics39  co_return;40}41#endif42