annotate clang/test/SemaCXX/coroutine-unhandled_exception-warning.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 79ff65ed7e25
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts \
anatofuz
parents:
diff changeset
2 // RUN: -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify \
anatofuz
parents:
diff changeset
3 // RUN: -fblocks -Wno-unreachable-code -Wno-unused-value
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts \
anatofuz
parents:
diff changeset
6 // RUN: -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify \
anatofuz
parents:
diff changeset
7 // RUN: -fblocks -Wno-unreachable-code -Wno-unused-value \
anatofuz
parents:
diff changeset
8 // RUN: -DDISABLE_WARNING -Wno-coroutine-missing-unhandled-exception
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 #if __has_feature(cxx_exceptions)
anatofuz
parents:
diff changeset
11 #error This test requires exceptions be disabled
anatofuz
parents:
diff changeset
12 #endif
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 #include "Inputs/std-coroutine.h"
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 using std::experimental::suspend_always;
anatofuz
parents:
diff changeset
17 using std::experimental::suspend_never;
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 #ifndef DISABLE_WARNING
anatofuz
parents:
diff changeset
20 struct promise_void { // expected-note {{defined here}}
anatofuz
parents:
diff changeset
21 #else
anatofuz
parents:
diff changeset
22 struct promise_void {
anatofuz
parents:
diff changeset
23 #endif
anatofuz
parents:
diff changeset
24 void get_return_object();
anatofuz
parents:
diff changeset
25 suspend_always initial_suspend();
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
26 suspend_always final_suspend() noexcept;
150
anatofuz
parents:
diff changeset
27 void return_void();
anatofuz
parents:
diff changeset
28 };
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 template <typename... T>
anatofuz
parents:
diff changeset
31 struct std::experimental::coroutine_traits<void, T...> { using promise_type = promise_void; };
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 #ifndef DISABLE_WARNING
anatofuz
parents:
diff changeset
34 void test0() { // expected-warning {{'promise_void' is required to declare the member 'unhandled_exception()' when exceptions are enabled}}
anatofuz
parents:
diff changeset
35 co_return;
anatofuz
parents:
diff changeset
36 }
anatofuz
parents:
diff changeset
37 #else
anatofuz
parents:
diff changeset
38 void test0() { // expected-no-diagnostics
anatofuz
parents:
diff changeset
39 co_return;
anatofuz
parents:
diff changeset
40 }
anatofuz
parents:
diff changeset
41 #endif