[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / coroutine-mixed-exp-namespace.cpp
blob97b4e687ed8702e05b8e962660b60dc7a6e632c6
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
5 #include "Inputs/std-coroutine-exp-namespace.h"
6 #include "Inputs/std-coroutine.h" // Second
8 struct my_awaitable {
9 bool await_ready() noexcept;
10 void await_suspend(std::experimental::coroutine_handle<> coro) noexcept;
11 void await_resume() noexcept;
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();
22 template <>
23 struct std::coroutine_traits<void> { using promise_type = promise_void; };
25 void 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:18 {{'coroutine_traits' declared here}}