1af9f3c6dSChuanqi Xu // This file is to test the mixed use of `std::experimental::coroutine_traits` and `std::coroutine_traits` 2*d4f09786SNathan Sidwell // which is similar to coroutine-mixed-exp-namespace. This file tests the relative order of 3ec117158SChuanqi Xu // included header wouldn't affect the diagnostic messages. 4ec117158SChuanqi Xu // RUN: %clang_cc1 -verify -std=c++20 -fsyntax-only %s 5ec117158SChuanqi Xu 6*d4f09786SNathan Sidwell #include "Inputs/std-coroutine.h" // First 7ec117158SChuanqi Xu #include "Inputs/std-coroutine-exp-namespace.h" 8ec117158SChuanqi Xu 9ec117158SChuanqi Xu struct my_awaitable { 10ec117158SChuanqi Xu bool await_ready() noexcept; 11ec117158SChuanqi Xu void await_suspend(std::experimental::coroutine_handle<> coro) noexcept; 12ec117158SChuanqi Xu void await_resume() noexcept; 13ec117158SChuanqi Xu }; 14ec117158SChuanqi Xu 15ec117158SChuanqi Xu struct promise_void { 16ec117158SChuanqi Xu void get_return_object(); 17ec117158SChuanqi Xu my_awaitable initial_suspend(); 18ec117158SChuanqi Xu my_awaitable final_suspend() noexcept; 19ec117158SChuanqi Xu void return_void(); 20ec117158SChuanqi Xu void unhandled_exception(); 21ec117158SChuanqi Xu }; 22ec117158SChuanqi Xu 23ec117158SChuanqi Xu template <> 24ec117158SChuanqi Xu struct std::coroutine_traits<void> { using promise_type = promise_void; }; 25ec117158SChuanqi Xu test()26ec117158SChuanqi Xuvoid test() { 27565c1757SNathan Sidwell co_return; // expected-error {{mixed use of std and std::experimental namespaces for coroutine components}} 28565c1757SNathan Sidwell // expected-warning@-1{{support for std::experimental::coroutine_traits will be removed}} 29*d4f09786SNathan Sidwell // expected-note@Inputs/std-coroutine-exp-namespace.h:8 {{'coroutine_traits' declared here}} 30*d4f09786SNathan Sidwell // expected-note@Inputs/std-coroutine.h:8 {{'coroutine_traits' declared here}} 31ec117158SChuanqi Xu } 32