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