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