Toolset update: VS 2022 17.14 Preview 1 by StephanTLavavej 路 Pull Request #5284 路 microsoft/STL (original) (raw)
In C++14 mode, as of VS 2022 17.14 Preview 1 and Clang 19.1.1:
- MSVC does NOT define the feature-test macro, but accepts the code (with a C5280 warning).
- Clang DOES define the feature-test macro, and accepts the code (with a -Wc++23-extensions warning).
- EDG does NOT define the feature-test macro, but accepts the code silently.
For Intel's compiler, which we don't support but which we do avoid gratuitously breaking, my experiments on Compiler Explorer indicate that they have Clang's behavior.
CUDA 12.4 was released in March 2024, and I suspect that their EDG version doesn't support this yet.
Additionally, split the macro into _STATIC_LAMBDA
to work around
VSO-2383148 "C++23 static lambdas aren't accepted by the old lambda processor".
This means that they aren't accepted in C++14/17, without enabling /permissive-
(strict mode) or /Zc:lambda
(new processor).
This also means that they aren't accepted in C++20/23 when /Zc:lambda-
(old processor) is used.
(Note: C++20/23 with /permissive
(permissive mode) still uses the new processor, and therefore works.)
Because none of this is Standard-mandated (it's a "nice to have" minor performance improvement),
we should just avoid static lambdas with MSVC while the bug remains active.