Skip to content

Commit 3db0061

Browse files
Merge pull request #5903 from TylerMSFT/whatsnew
17.14 whats new
2 parents 6a9073d + cecf9e1 commit 3db0061

File tree

5 files changed

+129
-26
lines changed

5 files changed

+129
-26
lines changed

docs/overview/cpp-conformance-improvements.md

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "C++ conformance improvements in Visual Studio 2022"
33
description: "Microsoft C++ in Visual Studio is improving standards conformance and fixing bugs regularly."
4-
ms.date: 2/11/2025
4+
ms.date: 05/13/2025
55
ms.service: "visual-cpp"
66
ms.subservice: "cpp-lang"
77
---
@@ -19,15 +19,79 @@ For changes in earlier versions of Visual Studio:
1919
| 2017 | [C++ conformance improvements in Visual Studio 2017](cpp-conformance-improvements-2017.md) |
2020
| 2003-2015 | [Visual C++ What's New 2003 through 2015](../porting/visual-cpp-what-s-new-2003-through-2015.md) |
2121

22+
## <a name="improvements_1714"></a> Conformance improvements in Visual Studio 2022 version 17.14
23+
24+
Visual Studio 2022 version 17.14 includes the following conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler.
25+
26+
### Conformance improvements
27+
28+
- Standard library hardening ([P3471R4](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3471r4.html)) turns some instances of undefined behavior in the standard library into a call to [__fastfail](../intrinsics/fastfail.md). Off by default. Define `_MSVC_STL_HARDENING=1` project-wide to enable.
29+
30+
### Enhanced behavior
31+
32+
- Implemented "destructor tombstones" to mitigate use-after-free mistakes. Off by default. Define `_MSVC_STL_DESTRUCTOR_TOMBSTONES=1` project-wide to enable.
33+
34+
### Bug fixes
35+
36+
- Fixed errant compiler errors when using `<format>` in a CUDA project.
37+
- Fixed a compiler issue where the address of a local variable could "leak" during `constexpr` evaluation. For example:
38+
39+
```cpp
40+
const unsigned & func()
41+
{
42+
const int x = 0;
43+
constexpr const unsigned & r1 = x; // Previously accepted, now an error
44+
return r1;
45+
}
46+
47+
auto r = func(); // Previously, the local address leaked
48+
```
49+
50+
**Example #2**
51+
52+
```cpp
53+
#include <initializer_list>
54+
55+
void test()
56+
{
57+
constexpr std::initializer_list<int> xs { 1, 2, 3 }; // Previously accepted, now an error
58+
59+
static constexpr std::initializer_list<int> ys { 1, 2, 3 }; // Correct usage - note use of static
60+
}
61+
```
62+
63+
- Code compiled with `/permissive-` no longer accepts a combination of `friend` and `static` on a declaration. The fix is usually to remove `static` from the declaration. For example:
64+
65+
```cpp
66+
struct S
67+
{
68+
friend static void f(); // Previously accepted, now emits error C2440: 'static' cannot be used with 'friend'
69+
};
70+
```
71+
72+
- Reference binding to volatile-qualified types fixed when referring to a base or derived class. For example:
73+
74+
```cpp
75+
struct A {};
76+
struct B : public A {};
77+
78+
void f(A&); // 1
79+
void f(const volatile A&); // 2
80+
81+
f(B{}); // Previously called 2. This is ill-formed under /permissive- or /Zc:referenceBinding. Chooses 1 if relaxed reference binding rules are enabled.
82+
```
83+
84+
For an in-depth summary of changes made to the Standard Template Library, including conformance changes, bug fixes, and performance improvements, see [STL Changelog VS 2022 17.14](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1714).
85+
2286
## <a name="improvements_1713"></a> Conformance improvements in Visual Studio 2022 version 17.13
2387

2488
Visual Studio 2022 version 17.13 includes the following conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler.
2589

2690
For an in-depth summary of changes made to the Standard Template Library, including conformance changes, bug fixes, and performance improvements, see [STL Changelog VS 2022 17.13](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1713).
2791

28-
### Argument-dependent lookup (ADL) change
92+
### Argument-dependent lookup (ADL)
2993

30-
Language constructs such as range-for and structured bindings have special argument-dependent lookup rules for certain identifiers such as `begin`, `end`, or `get`. Previously, this lookup included candidates from the `std` namespace, even when namespace `std` is not part of the ordinary set of associated namespaces for argument-dependent lookup.
94+
Language constructs such as range-for and structured bindings have special argument-dependent lookup rules for certain identifiers such as `begin`, `end`, or `get`. Previously, this lookup included candidates from the `std` namespace, even when namespace `std` isn't part of the ordinary set of associated namespaces for argument-dependent lookup.
3195

3296
Programs that introduced declarations to `std` for these constructs no longer compile. Instead, the declarations should be in a normal associated namespace for the types involved (possibly including the global namespace).
3397

@@ -73,9 +137,9 @@ For an in-depth summary of changes made to the Standard Template Library, includ
73137

74138
This is a source/binary breaking change.
75139

76-
The implicit conversion to `bool` from `_com_ptr_t` instances can be surprising or lead to compiler errors. Implicit conversion functions are discouraged by the [C++ Core Guidelines (C.164)](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ro-conversion), and `_com_ptr_t` contained implicit conversions to both `bool` and `Interface*`. These two implicit conversions can lead to ambiguities.
140+
The implicit conversion to `bool` from `_com_ptr_t` instances can be surprising or lead to compiler errors. The [C++ Core Guidelines (C.164)](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ro-conversion) discourage implicit conversion functions. And `_com_ptr_t` contained implicit conversions to both `bool` and `Interface*`. These two implicit conversions can lead to ambiguities.
77141

78-
To help address this, the conversion to `bool` is now explicit. The conversion to `Interface*` is unchanged.
142+
To address this, the conversion to `bool` is now explicit. The conversion to `Interface*` is unchanged.
79143

80144
A macro is provided to opt-out of this new behavior and restore the previous implicit conversion. Compile with `/D_COM_DISABLE_EXPLICIT_OPERATOR_BOOL` to opt-out of this change. We recommend that you modify the code to not rely on implicit conversions.
81145

10.6 KB
Loading
8.05 KB
Loading
5.69 KB
Loading

0 commit comments

Comments
 (0)