Skip to content

Commit 29395cb

Browse files
committed
draft
1 parent 3673803 commit 29395cb

File tree

3 files changed

+310
-1
lines changed

3 files changed

+310
-1
lines changed
Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
---
2+
title: "C++ conformance improvements in Microsoft C/C++ (MSVC)"
3+
description: "Summary of conformance improvements in Microsoft C/C++ (MSVC)"
4+
ms.date: 10/31/2025
5+
ms.service: "visual-cpp"
6+
ms.subservice: "cpp-lang"
7+
---
8+
# C++ Conformance improvements, behavior changes, and bug fixes in Microsoft C/C++ (MSVC)
9+
10+
Microsoft C/C++ makes conformance improvements and bug fixes in every release. This article lists the significant improvements by MSVC Build Tools version. To jump directly to the changes for a specific version, use the **In this article** links at the top of this article.
11+
12+
This document lists changes starting in November 2025 when Visual Studio and the MSVC toolset versioning diverged.
13+
14+
For changes in earlier versions of Visual Studio:
15+
16+
| Version | Conformance improvements link |
17+
|---|---|
18+
| 2022 | [C++ conformance improvements in Visual Studio 2022](cpp-conformance-improvements.md) |
19+
| 2019 | [C++ conformance improvements in Visual Studio 2019](cpp-conformance-improvements-2019.md) |
20+
| 2017 | [C++ conformance improvements in Visual Studio 2017](cpp-conformance-improvements-2017.md) |
21+
| 2003-2015 | [Visual C++ What's New 2003 through 2015](../porting/visual-cpp-what-s-new-2003-through-2015.md) |
22+
23+
## <a name="msvc_14_50"></a> C++ conformance improvements, behavior changes, and bug fixes in MSVC Build Tools v14.50
24+
25+
Microsoft C/C++ in Visual Studio (MSVC) Build Tools v14.50 introduces significant C++ language updates, conformance improvements, and bug fixes. This version ships with Visual Studio 2026 version 18.0 and includes version 19.50 of the MSVC compiler. You can try out these improvements by [downloading the Insiders release](https://aka.ms/vspreview).
26+
27+
This document details the C++ language conformance improvements and compiler enhancements included in MSVC Build Tools v14.50. For updates in the Standard Library, check out the [STL Changelog](https://github.com/microsoft/STL/wiki/Changelog), which is regularly updated.
28+
29+
As C++ standards progress in MSVC, you can follow along using the [cppreference compiler support table](https://en.cppreference.com/w/cpp/compiler_support.html) and help us identify what we should be working on next!
30+
31+
## C++23 Features
32+
33+
MSVC Build Tools v14.50 adds support for several C++23 features, bringing the compiler closer to full C++23 conformance.
34+
35+
### P0849R8: auto(x) - decay-copy in the language
36+
37+
[P0849R8](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0849r8.html) introduces the `auto(x)` syntax for decay-copy operations directly in the language, providing a more concise way to express decay-copy semantics.
38+
39+
Prior to P0849R8, you needed to explicitly perform decay operations:
40+
41+
```cpp
42+
// Prior to P0849R8:
43+
void pop_front_alike(auto& x) {
44+
using T = std::decay_t<decltype(x.front())>;
45+
std::erase(x, T(x.front()));
46+
}
47+
```
48+
49+
After P0849R8, you can use the simpler `auto(x)` syntax:
50+
51+
```cpp
52+
// After P0849R8:
53+
void pop_front_alike(auto& x) {
54+
std::erase(x, auto(x.front()));
55+
}
56+
```
57+
58+
This feature provides a standardized way to perform decay-copy operations, making code more readable and reducing the need for verbose template metaprogramming.
59+
60+
### P2437R1: C++23 `#warning` directive
61+
62+
[P2437R1](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2437r1.pdf) implements the C++23 `#warning` preprocessor directive, providing a standard way to emit warnings during compilation.
63+
64+
```cpp
65+
// Valid prior to C++23.
66+
#error bad configuration...
67+
68+
// Valid after C++23.
69+
#warning configuration deprecated...
70+
```
71+
72+
The `#warning` directive allows you to emit diagnostic messages without stopping compilation, making it useful for deprecation notices and configuration warnings.
73+
74+
### CWG Issue 2586: Explicit object parameter for assignment and comparison
75+
76+
[CWG Issue 2586](https://cplusplus.github.io/CWG/issues/2586) allows explicit object parameters in assignment and comparison operators, enabling more flexible operator definitions.
77+
78+
```cpp
79+
struct S {
80+
S& operator=(this S&, const S&) = default; // Valid after CWG2586.
81+
auto operator<=>(this const S&, const S&) = default; // Valid after CWG2586.
82+
};
83+
```
84+
85+
This change allows you to use the explicit object parameter syntax (deducing `this`) in assignment and comparison operators, providing more consistent syntax across different types of member functions.
86+
87+
### P2280R4: References to unknown values during constant evaluation
88+
89+
[P2280R4](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2280r4.html) allows references to unknown values during constant evaluation, relaxing restrictions on `constexpr` evaluation.
90+
91+
```cpp
92+
template <typename T, size_t N>
93+
constexpr size_t array_size(T (&)[N]) {
94+
return N;
95+
}
96+
97+
void check(int const (&param)[3]) {
98+
constexpr auto s2 = array_size(param); // Previously ill-formed, now accepted as a constant expression after P2280R4.
99+
}
100+
```
101+
102+
This improvement allows more code to be evaluated at compile time, particularly when dealing with function parameters in template contexts.
103+
104+
## Smaller Conformance Updates
105+
106+
MSVC Build Tools v14.50 includes numerous smaller conformance improvements that enhance C++ standard compliance:
107+
108+
### Core Working Group Issues
109+
110+
- **CWG2635**: Constrained structured bindings support
111+
- **CWG2465**: Coroutine parameters passed to promise constructor improvements
112+
- **CWG2496**: Ref-qualifiers and virtual overriding corrections
113+
- **CWG2506**: Structured bindings and array cv-qualifiers fixes
114+
- **CWG2507**: Default arguments for `operator[]` support
115+
- **CWG2585**: Behavior alignment with standard requirements
116+
- **CWG2521**: Deprecation of 'operator string-literal identifier'
117+
- **CWG2528**: Relaxed conversion rules for the spaceship operator
118+
119+
### Language Feature Enhancements
120+
121+
- **P2360R0**: Extended init-statement definition to allow alias-declarations
122+
- **P2290R3**: C++23 hexadecimal/octal delimited escape sequence support in string literals
123+
- **P2797R0**: Resolution for CWG2692 regarding static and explicit object member functions with the same parameter-type-lists
124+
- **P2266R3**: Simpler implicit move semantics
125+
126+
### Compiler Diagnostics
127+
128+
- Implementation of a warning to notify of enum type changes caused by `/Zc:enumTypes`
129+
130+
## Compiler Improvements in v14.50
131+
132+
MSVC Build Tools v14.50 includes extensive compiler improvements across multiple areas, focusing on reliability, correctness, and conformance.
133+
134+
### C++/CLI Improvements
135+
136+
The C++/CLI compiler received several important fixes:
137+
138+
- **ICE fixes**: Resolved internal compiler errors on use of `auto` in member declarations in C++/CLI managed types
139+
- **Static constexpr support**: Fixed crashes related to [static constexpr in C++/CLI](https://developercommunity.visualstudio.com/t/static-constexpr-causes-CCLI-compiler/1536217)
140+
- **Friend declarations**: Corrected crashes when [friend functions are used with managed types](https://developercommunity.visualstudio.com/t/Compiler-crash-A-managed-type-cannot-ha/1536159)
141+
- **Stack ref-types**: Fixed crashes in [C++/CLI code using ref-types on stack](https://developercommunity.visualstudio.com/t/clexe-terminates-with-error-code--52970/10777778)
142+
- **MFC compatibility**: Resolved [multiple errors in managed C++ code in MFC applications](https://developercommunity.visualstudio.com/t/Visual-Studio-1712-introduced-multiple-/10792822)
143+
144+
### Diagnostics Improvements
145+
146+
Enhanced diagnostic accuracy and clarity:
147+
148+
- Fixed incorrect diagnostic about [implicit enum type conversions in C even with explicit casts](https://developercommunity.visualstudio.com/t/warning-C5287:-operands-are-different-e/10877942)
149+
150+
### `constexpr` Enhancements
151+
152+
Significant improvements to `constexpr` evaluation and support:
153+
154+
#### Virtual Function Support
155+
- Fixed errors involving [virtual function calls at compile-time](https://developercommunity.visualstudio.com/t/MSVC-erroneously-claims-the-return-value/10184063)
156+
- Resolved [C++20 constexpr virtual polymorphism issues](https://developercommunity.visualstudio.com/t/C20-constexpr-virtual-polymorphism-is-/10348572)
157+
- Corrected [virtual constexpr function evaluation](https://developercommunity.visualstudio.com/t/Virtual-constexpr-function-did-not-evalu/10360010)
158+
159+
#### Expression Evaluation
160+
- Improved rejection of [overflow from addition and left shifting of constants](https://developercommunity.visualstudio.com/content/problem/1202945/signed-overflow-in-constant-core-expression-should.html)
161+
- Fixed scenarios where [constructors should be made implicitly constexpr](https://developercommunity.visualstudio.com/t/Multiple-constexpr-bugs-including-regre/10855054)
162+
- Resolved issues with [constexpr static data members and CRTP](https://developercommunity.visualstudio.com/content/problem/1110270/crtp-in-msvc-1924-not-seeing-variable.html)
163+
164+
#### Advanced `constexpr` Features
165+
- Fixed bugs related to [evaluating destructors of constant objects](https://developercommunity.visualstudio.com/t/MSVC-1437-40-forces-my-global-std::stri/10794576)
166+
- Improved [constexpr lambda captures with guaranteed copy elision](https://developercommunity.visualstudio.com/t/Lambda-in-a-function-template-requests-c/10922885)
167+
- Allowed [consteval constructor calls as direct-initialization arguments](https://developercommunity.visualstudio.com/t/MSVC-Fails-to-compile-list-and-direct-in/10915063)
168+
- Fixed issues with [consteval functions in `if consteval` contexts](https://developercommunity.visualstudio.com/t/The-consteval-function-is-not-an-immedia/10900618)
169+
170+
### C++ Modules Improvements
171+
172+
Enhanced C++20 modules support with numerous bug fixes:
173+
174+
#### Import and Export Fixes
175+
- Fixed bug with [importing friend declarations in nlohmann/json library](https://developercommunity.visualstudio.com/t/nlohmannjson-does-not-compile-as-C20-/10908164)
176+
- Resolved [compiler crashes with using-declarations from specializations](https://developercommunity.visualstudio.com/t/Internal-compiler-error-when-using-usin/10934729)
177+
- Fixed issues where [std::expected couldn't be specialized when imported](https://developercommunity.visualstudio.com/t/C1907-modules-constexpr-and-std::expect/10501314)
178+
179+
#### Function and Variable Handling
180+
- Corrected problems with [functions using types from named modules](https://developercommunity.visualstudio.com/t/Compiler-uses-non-exported-class-definit/10863347)
181+
- Fixed [importing constexpr functions with static local variables](https://developercommunity.visualstudio.com/t/ICE-when-calling-imported-function-that-/10913469)
182+
- Improved [pragma warning directive handling in modules](https://developercommunity.visualstudio.com/t/pragma-warningdisable-not-working-in-/10937100)
183+
184+
#### Real-World Compatibility
185+
- Fixed various issues preventing [Unreal Engine 5 from building with header units](https://developercommunity.visualstudio.com/t/Unreal-does-not-build-with-header-units-/10800119)
186+
- Resolved [C++ modules + boost::asio compatibility issues](https://developercommunity.visualstudio.com/t/C20-modules--boost::asio-still-being-/10038468)
187+
- Fixed problems with [specializations in the global module fragment](https://developercommunity.visualstudio.com/t/C20-modules:-specialzations-in-the-glo/10826499)
188+
189+
### Conformance Enhancements
190+
191+
Improved adherence to C++ standards:
192+
193+
#### Attribute Support
194+
- Added support for [`[[maybe_unused]]` on labels](https://developercommunity.visualstudio.com/t/unreferenced-label-when-ref-hidden-by-if/102076)
195+
- Fixed warning C4102 (unreferenced label) when the only reference was from a discarded `if constexpr` branch
196+
197+
#### Template and Specialization Fixes
198+
- [Diagnosed ill-formed friend explicit specializations](https://developercommunity.visualstudio.com/t/Defining-explicit-function-template-spec/10933841) that were incorrectly accepted in C++20 or later
199+
- Added `/Zc:enumEncoding` switch to [correctly encode enum non-type template parameters](https://developercommunity.visualstudio.com/t/Overload-resolution-fails-for-enum-non-t/10398088)
200+
- Fixed issues with [missing 'template' keyword diagnostics](https://developercommunity.visualstudio.com/t/No-diagnostic-for-missing-template-in-d/10501221)
201+
202+
### Reliability Improvements
203+
204+
Extensive internal compiler error (ICE) fixes and stability improvements:
205+
206+
#### Template-Related Fixes
207+
- Fixed [ICE on explicit class template instantiation with friend functions](https://developercommunity.visualstudio.com/t/Internal-compiler-error-ICE-on-explici/10903887)
208+
- Resolved [ICE with explicit variable template instantiations and PCH files](https://developercommunity.visualstudio.com/t/C-explicit-variable-template-instantia/10933044)
209+
- Corrected [compiler crashes with deep nesting of aggregates and initializer lists](https://developercommunity.visualstudio.com/t/Internal-Compiler-Error-Found-in-MSVC-14/10914206)
210+
211+
#### Lambda-Related Improvements
212+
- Fixed issues with [nested generic lambdas](https://developercommunity.visualstudio.com/t/VS-1714-Preview-30:-ICE:-error-C1001:-/10891418)
213+
- Resolved [ICE with lambda captures and template parameters](https://developercommunity.visualstudio.com/t/ICE-with-nested-std::visit--lambda-capt/10910959)
214+
- Corrected [lambda initialization problems](https://developercommunity.visualstudio.com/t/Internal-compiler-error-with-designated-/10618932)
215+
216+
#### Memory and Performance
217+
- Fixed [exponential memory growth during type deduction](https://developercommunity.visualstudio.com/t/VS-2022-C-compiler-uses-nearly-200x-as/10900008) with classes having many base classes
218+
- Improved [IL generation for temporaries bound to non-static data member references](https://developercommunity.visualstudio.com/t/CLexe-crashes-with-Access-Violation-on-/10878252)
219+
220+
### Correctness Improvements
221+
222+
Enhanced code generation and semantic analysis:
223+
224+
#### Exception Handling and References
225+
- Fixed [exception handling issues with unions](https://developercommunity.visualstudio.com/t/CLexe-exited-with-code--529706956-whe/10915135)
226+
- Improved [rvalue reference handling in lambda contexts](https://developercommunity.visualstudio.com/t/When-using-a-lambda-as-a-template-argume/10916555)
227+
- Corrected [explicit instantiation overload resolution with requires clauses](https://developercommunity.visualstudio.com/t/Overload-resolution-for-constrained-func/10107770)
228+
229+
#### Type System and Semantics
230+
- Fixed [noexcept specifier semantic issues](https://developercommunity2.visualstudio.com/t/noexcept-for-some-reason-work-with-type/1321108)
231+
- Improved [phase-1 name binding in non-static data member initializers](https://developercommunity.visualstudio.com/t/Wrong-context-for-class-field-initialize/10896684)
232+
- Corrected [value category determination for indirection and array expressions](https://developercommunity.visualstudio.com/t/cl-Preview-fails-to-properly-determine-a/10907452)
233+
234+
#### Template and SFINAE
235+
- Fixed [template-id parsing in alias declarations](https://developercommunity.visualstudio.com/t/Source-code-parsing-error-in-boostparse/10869546)
236+
- Improved [partial ordering with template parameter objects](https://developercommunity.visualstudio.com/t/Template-Specialization-is-not-selected-/10902294)
237+
- Resolved [constexpr variable re-declaration issues](https://developercommunity.visualstudio.com/t/A-C1001-error-occurs-in-VS1714/10909397)
238+
239+
#### Advanced Language Features
240+
- Fixed [`__declspec(no_sanitize_address)` handling on lambdas](https://developercommunity.visualstudio.com/t/Address-Sanitizer-declspecsattributes-d/10850249)
241+
- Improved [static inline data member instantiation points](https://developercommunity.visualstudio.com/t/static-inline-atomic-and-another-atomic-/10203656)
242+
- Corrected [static operator() in abbreviated function templates](https://developercommunity.visualstudio.com/t/Call-to-static-operator-is-elided/10908158)
243+
244+
#### Standard Library Integration
245+
- Fixed [`std::bit_cast` internal compiler errors](https://developercommunity.visualstudio.com/t/__builtin_bit_cast-Internal-compiler-err/10939926)
246+
- Improved [modulo operator handling in variadic templates](https://developercommunity.visualstudio.com/t/Issue-in-specific-conditions-with-modulo/10940009)
247+
- Resolved [class template argument deduction issues](https://developercommunity.visualstudio.com/t/Deduction-of-class-template-arguments-pi/10939918)
248+
249+
#### C++20 and C++23 Features
250+
- Enhanced [multidimensional operator[] support](https://developercommunity.visualstudio.com/t/Multidimensional-operator-with-Wall-r/10876026)
251+
- Fixed [`using enum` declaration handling](https://developercommunity.visualstudio.com/t/using-enum-c-20-doesnt-supported-as-we/10926317)
252+
- Improved [concept and constraint evaluation](https://developercommunity.visualstudio.com/t/VS-1714-if-constexpr-requires--does/10905731)
253+
254+
### C Compiler Improvements
255+
256+
#### C23 Language Features
257+
- Fixed `typeof` behavior with function types: In C23, functions no longer [decay to function pointers when used as arguments to `typeof`](https://developercommunity.visualstudio.com/t/__typeof__-not-working-with-function-typ/10891974)
258+
259+
## Migrating to MSVC Build Tools v14.50
260+
261+
When upgrading to MSVC Build Tools v14.50, consider the following potential breaking changes and migration guidance:
262+
263+
### C++23 Feature Adoption
264+
- Update code to take advantage of new `auto(x)` decay-copy syntax for cleaner template code
265+
- Consider using `#warning` directives for deprecation notices instead of error-prone conditional compilation
266+
- Review explicit object parameter usage in operators for improved consistency
267+
268+
### `constexpr` Improvements
269+
- Existing `constexpr` code may now compile that previously failed, particularly with virtual functions
270+
- Review constant evaluation code for potential new optimization opportunities
271+
- Update CRTP patterns that may now work correctly with static constexpr members
272+
273+
### Modules Migration
274+
- Projects using C++20 modules should see improved stability and compatibility
275+
- Header units now work more reliably with large codebases like Unreal Engine 5
276+
- Consider migrating from traditional headers to modules for better compilation performance
277+
278+
### Compiler Diagnostics
279+
- New warnings may appear for previously undiagnosed issues
280+
- Review enum type usage if using `/Zc:enumTypes`
281+
- Update code that relies on implicit conversions that may now be flagged
282+
283+
### C Code Updates
284+
- C23 features are available with `/std:clatest`
285+
- `typeof` behavior changes may affect existing code
286+
- Review preprocessor usage for new `__VA_OPT__` availability
287+
288+
## Conclusion
289+
290+
MSVC Build Tools v14.50 represents a significant advancement in C++ compiler technology, bringing substantial improvements in C++23 conformance, reliability, and correctness. The extensive bug fixes and enhancements make this release particularly valuable for large-scale C++ development projects.
291+
292+
Key highlights include:
293+
- Advanced C++23 feature support including `auto(x)` decay-copy and `#warning` directive
294+
- Comprehensive `constexpr` improvements, particularly for virtual functions
295+
- Major stability improvements for C++ modules
296+
- Extensive reliability fixes reducing internal compiler errors
297+
- Enhanced C++/CLI support for managed code scenarios
298+
299+
For the latest updates and to provide feedback, please visit the [Visual Studio Developer Community](https://developercommunity.visualstudio.com/) or contact the team at [[email protected]](mailto:[email protected]). Follow us on Twitter [@visualc](https://twitter.com/visualc) or BlueSky [@msftcpp.bsky.social](https://bsky.app/profile/msftcpp.bsky.social).
300+
301+
If you encounter problems with MSVC in Visual Studio 2026, please let us know via the [Report a Problem](how-to-report-a-problem-with-the-visual-cpp-toolset.md) option, either from the installer or the Visual Studio IDE itself.
302+
303+
## See also
304+
305+
[Microsoft C/C++ language conformance](visual-cpp-language-conformance.md)
306+
[What's new for C++ in Visual Studio](what-s-new-for-visual-cpp-in-visual-studio.md)
307+
[C++ conformance improvements in Visual Studio 2022](cpp-conformance-improvements.md)

0 commit comments

Comments
 (0)