[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / coroutine-builtins.cpp
blobf2d0eda37d7071526ec384092d10112d1f33dd49
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -DERRORS %s
4 // Check that we don't crash when using __builtin_coro_* without the fcoroutine-ts or -std=c++20 option
6 #ifdef ERRORS
7 // expected-error@#A{{use of undeclared identifier '__builtin_coro_done'}}
8 // expected-error@#B{{use of undeclared identifier '__builtin_coro_id'}}
9 // expected-error@#C{{use of undeclared identifier '__builtin_coro_alloc'}}
10 #else
11 // expected-no-diagnostics
12 #endif
14 int main() {
15 void *co_h;
16 bool d = __builtin_coro_done(co_h); // #A
17 __builtin_coro_id(32, 0, 0, 0); // #B
18 __builtin_coro_alloc(); // #C