https://developercommunity.visualstudio.com/t/Regression:-No-deprecation-warnings-for/11035559
Visual Studio 2022 does not provide a deprecation warning for initialized declarations in C projects with the platform toolset v143.
main.c
1. static __declspec(deprecated) int func()
2. {
3. return 0;
4. }
5.
6. int main()
7. {
8. // 1) Deprecation warning.
9. func();
10.
11. // 2) Deprecation warning.
12. int a;
13. a = func();
14.
15. // 3) No deprecation warning.
16. int b = func();
17.
18. return 0;
19. }Error List
This looks like a regression relative to the platform toolset v142, where the warning works as expected:
Below are godbolt links demonstrating this regression in MSVC:
- x64 MSVC v19.37 VS17.7 (works)
- x64 MSVC v19.38 VS17.8 (does not work)
Also:
- This problem reproduces in Visual Studio 2026 with the platform toolset v145.
- This problem does not reproduce in
C++projects.
- Download the project.
- Open the solution.
- Ensure the platform toolset v143 is selected.
Configuration Properties -> General -> Platform Toolset -> Visual Studio 2022 (v143).
- Build the project.
- Check the
Outputwindow orError Listfor warnings.
Microsoft Visual Studio 2022 Version 17.14.23
Windows 11 Version 10.0.26100 Build 26100

