Skip to content

Conversation

@StephanTLavavej
Copy link
Member

In the MSVC Build Tools 14.50 shipping in VS 2026 18.0, the /await compiler option was officially deprecated and emits a driver warning. However, driver warnings don't terminate builds, even with /WX:

C:\Temp>type meow.cpp
#include <cstdio>
int main() {
    std::puts("Hello, deprecated world!");
}
C:\Temp>cl /EHsc /nologo /W4 /WX /await meow.cpp && meow
cl : Command line warning D9047 : option 'await' has been deprecated and will be removed in a future release.
    Standard C++ coroutines are available by default in C++20 or later, or use '/await:strict' in earlier language modes.
meow.cpp
Hello, deprecated world!

To turn up the heat, I want to "hard deprecate" the experimental coroutine headers, matching what we did with <experimental/filesystem>, <hash_map>, and <hash_set>. This means adding an impossible-to-miss compiler error, with an escape hatch. This will ship in MSVC Build Tools 14.51, making MSVC Build Tools 14.52 the earliest we could completely remove the headers (it remains to be seen whether we can/will be that aggressive).

I am also improving our various warning and error messages to guide users towards the modern Standard ways.

Drop the undocumented `_SILENCE_CLANG_COROUTINE_MESSAGE` escape hatch.

Emit a numbered STL1009 `static_assert` instead of using preprocessor `#error`.

Mention C++23 `<generator>`.

Add the block to `<experimental/generator>`, which doesn't necessarily drag in `<experimental/coroutine>`.
(`<experimental/generator>` might actually work for Clang, but I don't want to increase our support burden.)
`__cpp_impl_coroutine` indicates that modern coroutines are available, so don't waste time explaining how the experimental headers worked.
Instead, explain to the user why they're in modern mode (clearly distinguishing C++20 which has modern support by default, from
C++14/17 explicitly opting into Future Technology with /await:strict). Then tell them to include the Standard header, and not to include
the experimental headers.
…ator>`.

Explain how compiler support for either legacy coroutines or standard C++20 coroutines is needed, but then
guide the user towards including C++23 `<generator>`.
Make the warning for /await sound more dire by saying that `<coroutine>` is "incompatible" instead of merely "not available".

Emphasize that it is "the deprecated /await compiler option", making it clear that it should be removed.

Don't say "or use /await:strict for standard coroutines". If the user is in C++20 or later mode, removing deprecated /await is sufficient.
If they're in C++14/17 mode, warning STL4038 immediately below will tell them about /await:strict.

Don't tell users to use `<experimental/coroutine>`.

Slightly clarify warning STL4038, explaining that /await:strict is for C++14/17.
Follow `<experimental/filesystem>` phrasing by adding "by Microsoft" and "superseded" language.
We don't need to shout "BUT YOU HAVE BEEN WARNED" a second time, but an ominous "for now" will do.
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner October 24, 2025 20:52
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Oct 24, 2025
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews Oct 24, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Final Review in STL Code Reviews Oct 24, 2025
Copy link
Member

@davidmrdavid davidmrdavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll miss the "YOU HAVE BEEN WARNED" message, but agreed it's probably best without it.
"[...] FOR NOW" 😈

LGTM.

@StephanTLavavej StephanTLavavej moved this from Final Review to Ready To Merge in STL Code Reviews Oct 27, 2025
@StephanTLavavej
Copy link
Member Author

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Oct 28, 2025
@kobykahane
Copy link

One reason we're still on the experimental generator header is DevCom-10920618 (apparently the MSVC equivalent of llvm/llvm-project#56507) - using the new implementation is blocked on 32-bit x86 MSVC with /guard:cf. It'd be appreciated if its final removal from STL would be gated on this compiler bug being fixed.

@StephanTLavavej
Copy link
Member Author

Thanks, I've marked that bug as "STL-requested" and commented internally. A couple of back-end devs were analyzing it earlier this month, but I haven't seen a PR yet.

@StephanTLavavej StephanTLavavej merged commit 1118f37 into microsoft:main Oct 30, 2025
39 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews Oct 30, 2025
@StephanTLavavej StephanTLavavej deleted the no-mo-coro branch October 30, 2025 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants