1 // This file is to test the mixed use of `std::experimental::coroutine*` and `std::coroutine*` 2 // wouldn't make the compiler to crash and emit the diagnostic message correctly. 3 // RUN: %clang_cc1 -verify -std=c++20 -fsyntax-only %s 4 5 #include "Inputs/std-coroutine-exp-namespace.h" 6 #include "Inputs/std-coroutine.h" // Second 7 8 struct my_awaitable { 9 bool await_ready() noexcept; 10 void await_suspend(std::experimental::coroutine_handle<> coro) noexcept; 11 void await_resume() noexcept; 12 }; 13 14 struct promise_void { 15 void get_return_object(); 16 my_awaitable initial_suspend(); 17 my_awaitable final_suspend() noexcept; 18 void return_void(); 19 void unhandled_exception(); 20 }; 21 22 template <> 23 struct std::coroutine_traits<void> { using promise_type = promise_void; }; 24 test()25void test() { 26 co_return; // expected-error {{mixed use of std and std::experimental namespaces for coroutine components}} 27 // expected-warning@-1{{support for std::experimental::coroutine_traits will be removed}} 28 // expected-note@Inputs/std-coroutine-exp-namespace.h:8 {{'coroutine_traits' declared here}} 29 // expected-note@Inputs/std-coroutine.h:8 {{'coroutine_traits' declared here}} 30 } 31