1 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
3 #include "Inputs/std-coroutine.h"
7 resumable
get_return_object() { return {}; }
8 auto initial_suspend() { return std::suspend_always(); }
9 auto final_suspend() noexcept
{ return std::suspend_always(); }
10 void unhandled_exception() {}
15 resumable
f1(int &out
, int *inst
) {
16 static void* dispatch_table
[] = {&&inc
, // expected-error {{the GNU address of label extension is not allowed in coroutines.}}
17 &&suspend
, // expected-error {{the GNU address of label extension is not allowed in coroutines.}}
18 &&stop
}; // expected-error {{the GNU address of label extension is not allowed in coroutines.}}
19 #define DISPATCH() goto *dispatch_table[*inst++]
25 co_await
std::suspend_always
{};
32 resumable
f2(int &out
, int *inst
) {
33 void* dispatch_table
[] = {nullptr, nullptr, nullptr};
34 dispatch_table
[0] = &&inc
; // expected-error {{the GNU address of label extension is not allowed in coroutines.}}
35 dispatch_table
[1] = &&suspend
; // expected-error {{the GNU address of label extension is not allowed in coroutines.}}
36 dispatch_table
[2] = &&stop
; // expected-error {{the GNU address of label extension is not allowed in coroutines.}}
37 #define DISPATCH() goto *dispatch_table[*inst++]
43 co_await
std::suspend_always
{};
50 resumable
f3(int &out
, int *inst
) {
51 void* dispatch_table
[] = {nullptr, nullptr, nullptr};
53 dispatch_table
[0] = &&inc
; // expected-error {{the GNU address of label extension is not allowed in coroutines.}}
54 dispatch_table
[1] = &&suspend
; // expected-error {{the GNU address of label extension is not allowed in coroutines.}}
55 dispatch_table
[2] = &&stop
; // expected-error {{the GNU address of label extension is not allowed in coroutines.}}
56 #define DISPATCH() goto *dispatch_table[*inst++]
62 co_await
std::suspend_always
{};