Continuing the improvement of std/std::experimental mixing diagnostics ...
First, let's check we get a TemplateDecl, before complaining about where it might have been found.
Second, if it came from an unexpected place, show where that location is with a 'declared here' note.
(Still an error when std and std::experimental both have decls)
Instead of doing this -verify=expected,declared, I have another trick for you from the libcxx test suite. :) IIUC, the compiler output we expect is
../clang/test/SemaCXX/co_await-range-for-exp-namespace.cpp:53:7: warning: support for std::experimental::coroutine_traits will be removed in LLVM 15; use std::coroutine_traits instead [-Wdeprecated-experimental-coroutine] for co_await (auto i : arr) {} // expected-warning {{support for std::experimental::coroutine_traits will be removed}} ^ ../clang/test/SemaCXX/Inputs/std-coroutine-exp-namespace.h:8:8: note: 'coroutine_traits' declared here struct coroutine_traits { using promise_type = typename Ret::promise_type; }; ^So, down on line 53, I think we should write
MyForLoopArrayAwaiter g() { int arr[10] = {0}; for co_await (auto i : arr) {} // expected-warning@-1 {{support for std::experimental::coroutine_traits will be removed}} // expected-note@Inputs/std-coroutine-exp-namespace.h:8 {{'coroutine_traits' declared here}} // expected-error@-3 {{call to deleted member function 'await_transform'}} // expected-note@-4 {{'await_transform' implicitly required by 'co_await' here}} }And then on line 3 we can just write -verify. And in Inputs/std-coroutine-exp-namespace.h itself, we don't need to write anything.
This keeps the test more "all in one place," which I think is more readable/understandable.
(Likewise throughout. I assume this will have a big effect on all these tests.)