|
| 1 | +--- |
| 2 | +title: "/C++ Conformance improvements, behavior changes, and bug fixes in Microsoft C++ (MSVC) Build Tools" |
| 3 | +description: "Summary of conformance improvements in Microsoft C/C++ (MSVC)" |
| 4 | +ms.date: 11/03/2025 |
| 5 | +ms.service: "visual-cpp" |
| 6 | +ms.subservice: "cpp-lang" |
| 7 | +--- |
| 8 | +# C/C++ Conformance improvements, behavior changes, and bug fixes in Microsoft C++ (MSVC) Build Tools |
| 9 | + |
| 10 | +Microsoft C++ (MSVC) Build Tools makes conformance improvements and bug fixes in every release. Starting with Visual Studio 2026 version 18.0, major improvements are organized by MSVC Build Tools version number. To jump directly to the changes for a specific version, use the **In this article** links at the top of this article. |
| 11 | + |
| 12 | +For changes in earlier versions of Visual Studio: |
| 13 | + |
| 14 | +| Version | Conformance improvements link | |
| 15 | +|---|---| |
| 16 | +| 2022 | [C++ conformance improvements in Visual Studio 2022](cpp-conformance-improvements.md) | |
| 17 | +| 2019 | [C++ conformance improvements in Visual Studio 2019](cpp-conformance-improvements-2019.md) | |
| 18 | +| 2017 | [C++ conformance improvements in Visual Studio 2017](cpp-conformance-improvements-2017.md) | |
| 19 | +| 2003-2015 | [Visual C++ What's New 2003 through 2015](../porting/visual-cpp-what-s-new-2003-through-2015.md) | |
| 20 | + |
| 21 | +## <a name="msvc_14_50"></a> C++ conformance improvements, behavior changes, and bug fixes in MSVC Build Tools v14.50 |
| 22 | + |
| 23 | +MSVC Build Tools v14.50 introduces improvements to the MSVC compiler and standard library, including better C++23 standards conformance, enhanced reliability, and improved correctness. This release also includes numerous bug fixes and updates that benefit large-scale C++ development. |
| 24 | + |
| 25 | +This version shipped first with Visual Studio 2026 version 18.0 and includes version 19.50 of the MSVC compiler. |
| 26 | + |
| 27 | +Key highlights of this release include: |
| 28 | +- Advanced C++23 feature support including `auto(x)` decay-copy and `#warning` directive. |
| 29 | +- Comprehensive `constexpr` improvements, particularly for virtual functions. |
| 30 | +- Major stability improvements for C++ modules. |
| 31 | +- Extensive reliability fixes reducing internal compiler errors. |
| 32 | +- Enhanced C++/CLI support for managed code scenarios. |
| 33 | +- The Microsoft C++ standard library (MSVC STL) no longer supports targeting Windows 7/Server 2008 R2, Windows 8/Server 2012, or Windows 8.1/Server 2012 R2. |
| 34 | +- Windows 10/Server 2016 are the minimum supported operating systems. |
| 35 | + |
| 36 | +For more information about performance improvements, bug fixes, and conformance updates in the standard library, see [STL Changelog](https://github.com/microsoft/STL/wiki/Changelog), which is updated regularly. |
| 37 | + |
| 38 | +## C++23 Features |
| 39 | + |
| 40 | +MSVC Build Tools v14.50 adds support for several C++23 features, bringing the compiler closer to full C++23 conformance. |
| 41 | + |
| 42 | +### P0849R8: auto(x) - decay-copy in the language |
| 43 | + |
| 44 | +[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. |
| 45 | + |
| 46 | +Before P0849R8, you needed to explicitly perform decay operations: |
| 47 | + |
| 48 | +```cpp |
| 49 | +// Before P0849R8: |
| 50 | +void pop_front_alike(auto& x) |
| 51 | +{ |
| 52 | + using T = std::decay_t<decltype(x.front())>; |
| 53 | + std::erase(x, T(x.front())); |
| 54 | +} |
| 55 | +``` |
| 56 | +
|
| 57 | +After P0849R8, you can use the simpler `auto(x)` syntax: |
| 58 | +
|
| 59 | +```cpp |
| 60 | +// After P0849R8: |
| 61 | +void pop_front_alike(auto& x) |
| 62 | +{ |
| 63 | + std::erase(x, auto(x.front())); |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +This feature provides a standardized way to perform decay-copy operations, making code more readable and reducing the need for verbose template metaprogramming. |
| 68 | + |
| 69 | +### P2437R1: C++23 `#warning` directive |
| 70 | + |
| 71 | +[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. |
| 72 | + |
| 73 | +```cpp |
| 74 | +// Valid before C++23. |
| 75 | +#error bad configuration... |
| 76 | + |
| 77 | +// Valid after C++23. |
| 78 | +#warning configuration deprecated... |
| 79 | +``` |
| 80 | + |
| 81 | +The `#warning` directive allows you to emit diagnostic messages without stopping compilation, making it useful for deprecation notices and configuration warnings. For more information, see [#warning directive (C/C++)](/cpp/preprocessor/hash-warning-directive-c-cpp). |
| 82 | + |
| 83 | +### CWG Issue 2586: Explicit object parameter for assignment and comparison |
| 84 | + |
| 85 | +[CWG Issue 2586](https://cplusplus.github.io/CWG/issues/2586) allows explicit object parameters in assignment and comparison operators, enabling more flexible operator definitions. |
| 86 | + |
| 87 | +```cpp |
| 88 | +struct S |
| 89 | +{ |
| 90 | + S& operator=(this S&, const S&) = default; // Valid after CWG2586. |
| 91 | + auto operator<=>(this const S&, const S&) = default; // Valid after CWG2586. |
| 92 | +}; |
| 93 | +``` |
| 94 | + |
| 95 | +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. |
| 96 | + |
| 97 | +### P2266R1 : Simpler implicit move |
| 98 | + |
| 99 | +The introduction of [P2266R1](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2266r1.html) may cause code that was previously treated as an lvalue to be treated as an xvalue or a prvalue. For example: |
| 100 | + |
| 101 | +```cpp |
| 102 | +#include <utility> |
| 103 | + |
| 104 | +template<typename T> |
| 105 | +T& f(T&& t) |
| 106 | +{ |
| 107 | + return t; |
| 108 | +} |
| 109 | + |
| 110 | +struct S { }; |
| 111 | + |
| 112 | +void g() |
| 113 | +{ |
| 114 | + S s1{ }; |
| 115 | + S& s2 = f(std::move(s1)); |
| 116 | +} |
| 117 | +``` |
| 118 | +
|
| 119 | +In C++20, and earlier, this code compiled because even though the type of `t` is `S&&` the use of `t` in `return t` is treated as a glvalue and so it can bind to the return type.\ |
| 120 | +With C++23, `t` is treated as an xvalue and so it can't bind to an lvalue reference.\ |
| 121 | +One fix is to change to the return type of the function from `T&` to `T&&` but this may affect code that calls this function. An alternative is to use the feature test macro that is associated with this change. For example: |
| 122 | +
|
| 123 | +```cpp |
| 124 | +#include <type_traits> |
| 125 | +
|
| 126 | +template<typename T> |
| 127 | +T& f(T&& t) |
| 128 | +{ |
| 129 | +#if defined(__cpp_implicit_move) |
| 130 | + return static_cast<std::remove_reference_t<T>&>(t); |
| 131 | +#else |
| 132 | + return t; |
| 133 | +#endif |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +Adding the cast means that the value-category of the return expression is now an lvalue and so it can bind to the return type. |
| 138 | + |
| 139 | +### P2280R4: References to unknown values during constant evaluation |
| 140 | + |
| 141 | +[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. |
| 142 | + |
| 143 | +```cpp |
| 144 | +template <typename T, size_t N> |
| 145 | +constexpr size_t array_size(T (&)[N]) |
| 146 | +{ |
| 147 | + return N; |
| 148 | +} |
| 149 | + |
| 150 | +void check(int const (¶m)[3]) |
| 151 | +{ |
| 152 | + constexpr auto s2 = array_size(param); // Previously ill-formed, now accepted as a constant expression after P2280R4. |
| 153 | +} |
| 154 | +``` |
| 155 | +
|
| 156 | +This improvement allows more code to be evaluated at compile time, particularly when dealing with function parameters in template contexts. |
| 157 | +
|
| 158 | +## Conformance enhancements |
| 159 | +
|
| 160 | +Improved adherence to C++ standards includes better handling of attributes, templates, and C++20/C++23 features. |
| 161 | +
|
| 162 | +### Attribute support |
| 163 | +
|
| 164 | +- Added support for [`[[maybe_unused]]` on labels](https://developercommunity.visualstudio.com/t/unreferenced-label-when-ref-hidden-by-if/102076). |
| 165 | +- Fixed warning C4102 (unreferenced label) when the only reference was from a discarded `if constexpr` branch. |
| 166 | +
|
| 167 | +### Template and specialization fixes |
| 168 | +
|
| 169 | +- [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. |
| 170 | +- Added `/Zc:enumEncoding` switch to [correctly encode enum nontype template parameters](https://developercommunity.visualstudio.com/t/Overload-resolution-fails-for-enum-non-t/10398088). |
| 171 | +- Fixed issues with [missing 'template' keyword diagnostics](https://developercommunity.visualstudio.com/t/No-diagnostic-for-missing-template-in-d/10501221) |
| 172 | +
|
| 173 | +### C++20 and C++23 Features |
| 174 | +
|
| 175 | +- Enhanced [multidimensional `operator[]` support](https://developercommunity.visualstudio.com/t/Multidimensional-operator-with-Wall-r/10876026) |
| 176 | +- Improved [concept and constraint evaluation](https://developercommunity.visualstudio.com/t/VS-1714-if-constexpr-requires--does/10905731) |
| 177 | +
|
| 178 | +### Smaller conformance updates |
| 179 | +
|
| 180 | +MSVC Build Tools v14.50 includes numerous smaller conformance improvements that enhance C++ standard compliance: |
| 181 | +
|
| 182 | +- [CWG2635](https://cplusplus.github.io/CWG/issues/2635): Constrained structured bindings support |
| 183 | +- [CWG2465](https://cplusplus.github.io/CWG/issues/2465): Coroutine parameters passed to promise constructor improvements |
| 184 | +- [CWG2496](https://cplusplus.github.io/CWG/issues/2496): Ref-qualifiers and virtual overriding corrections |
| 185 | +- [CWG2506](https://cplusplus.github.io/CWG/issues/2506): Structured bindings and array cv-qualifiers fixes |
| 186 | +- [CWG2507](https://cplusplus.github.io/CWG/issues/2507): Default arguments for `operator[]` support |
| 187 | +- [CWG2585](https://cplusplus.github.io/CWG/issues/2585): Behavior alignment with standard requirements |
| 188 | +- [CWG2521](https://cplusplus.github.io/CWG/issues/2521): Deprecation of 'operator string-literal identifier' |
| 189 | +- [CWG2528](https://cplusplus.github.io/CWG/issues/2528): Relaxed conversion rules for the spaceship operator |
| 190 | +- [P2360R0](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2360r0.html): Extended init-statement definition to allow alias-declarations |
| 191 | +- [P2290R3](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2290r3.pdf): C++23 hexadecimal/octal delimited escape sequence support in string literals |
| 192 | +- [P2797R0](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2797r0.html): Resolution for CWG2692 regarding static and explicit object member functions with the same parameter-type-lists |
| 193 | +- [P2266R3](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2266r3.html): Simpler implicit move semantics |
| 194 | +
|
| 195 | +## Bug fixes |
| 196 | +
|
| 197 | +Bug fixes for C++ Modules, `constexpr`, and other fixes were made in MSVC Build Tools v14.50. |
| 198 | +
|
| 199 | +For a detailed list of bug fixes, see [Compiler Improvements in v14.50](https://devblogs.microsoft.com/cppblog/c-language-updates-in-msvc-build-tools-v14-50/#compiler-improvements-in-v14.50). |
| 200 | +
|
| 201 | +**Encoding of certain nontype template arguments corrected** |
| 202 | +
|
| 203 | +Affects `/std:c++20` or later. |
| 204 | +
|
| 205 | +Certain nontype pointer type template arguments involving subobjects could lead to linking issues or in some cases silent bad code generation where what should be distinct specializations collide. |
| 206 | +
|
| 207 | +```cpp |
| 208 | +struct A |
| 209 | +{ |
| 210 | + int x; |
| 211 | +}; |
| 212 | +
|
| 213 | +struct B |
| 214 | +{ |
| 215 | + int y; |
| 216 | +}; |
| 217 | +
|
| 218 | +template <auto p> void f(); |
| 219 | +
|
| 220 | +int main() |
| 221 | +{ |
| 222 | + static A a; |
| 223 | + static B b; |
| 224 | + constexpr auto px = &a.x; |
| 225 | + constexpr auto py = &b.y; |
| 226 | + f<px>(); // incorrect encoding of argument 'px' |
| 227 | + f<py>(); // incorrect encoding of argument 'py', collided with 'px'. |
| 228 | +} |
| 229 | +``` |
| 230 | + |
| 231 | +With this fix, the two calls to `f` get distinct encodings, as required. |
| 232 | + |
| 233 | +## Migrating to MSVC Build Tools v14.50 |
| 234 | + |
| 235 | +When upgrading to MSVC Build Tools v14.50, consider the following potential breaking changes and migration guidance: |
| 236 | + |
| 237 | +### C++23 feature adoption |
| 238 | +- Update code to take advantage of new `auto(x)` decay-copy syntax for cleaner template code |
| 239 | +- Consider using `#warning` directives for deprecation notices instead of error-prone conditional compilation |
| 240 | +- Review explicit object parameter usage in operators for improved consistency |
| 241 | + |
| 242 | +### `constexpr` improvements |
| 243 | +- Existing `constexpr` code may now compile that previously failed, particularly with virtual functions |
| 244 | +- Review constant evaluation code for potential new optimization opportunities |
| 245 | +- Update CRTP patterns that may now work correctly with static constexpr members |
| 246 | + |
| 247 | +### Modules migration |
| 248 | +- Projects using C++20 modules should see improved stability and compatibility |
| 249 | +- Header units now work more reliably with large codebases like Unreal Engine 5 |
| 250 | +- Consider migrating from traditional headers to modules for better compilation performance |
| 251 | + |
| 252 | +### Compiler diagnostics |
| 253 | +- New warnings may appear for previously undiagnosed issues |
| 254 | +- Review enum type usage if using `/Zc:enumTypes` |
| 255 | +- Update code that relies on implicit conversions that may now be flagged |
| 256 | + |
| 257 | +### C code updates |
| 258 | +- C23 features are available with `/std:clatest` |
| 259 | +- `typeof` behavior changes may affect existing code |
| 260 | +- Review preprocessor usage for new `__VA_OPT__` availability |
| 261 | + |
| 262 | +## Provide feedback |
| 263 | + |
| 264 | +For the latest updates and to provide feedback, visit the [Visual Studio Developer Community ](https://developercommunity.visualstudio.com/) or contact the team at [[email protected]](mailto:[email protected]). Follow us on X [@visualc](https://x.com/visualc) or BlueSky [@msftcpp.bsky.social ](https://bsky.app/profile/msftcpp.bsky.social). |
| 265 | + |
| 266 | +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. |
| 267 | + |
| 268 | +## See also |
| 269 | + |
| 270 | +[Microsoft C/C++ language conformance](visual-cpp-language-conformance.md)\ |
| 271 | +[What's new for C++ in Visual Studio](what-s-new-for-visual-cpp-in-visual-studio.md)\ |
| 272 | +[C++ conformance improvements in Visual Studio 2022](cpp-conformance-improvements.md) |
0 commit comments