view clang/test/SemaCXX/coroutine-builtins.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
line wrap: on
line source

// RUN: %clang_cc1 -fsyntax-only -verify -fcoroutines-ts %s
// RUN: %clang_cc1 -fsyntax-only -verify -DERRORS %s

// Check that we don't crash when using __builtin_coro_* without the fcoroutine-ts option

#ifdef ERRORS
// expected-error@#A{{use of undeclared identifier '__builtin_coro_done'}}
// expected-error@#B{{use of undeclared identifier '__builtin_coro_id'}}
// expected-error@#C{{use of undeclared identifier '__builtin_coro_alloc'}}
#else
// expected-no-diagnostics
#endif

int main() {
  void *co_h;
  bool d = __builtin_coro_done(co_h); // #A
  __builtin_coro_id(32, 0, 0, 0);     // #B
  __builtin_coro_alloc();             // #C
}