You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/overview/cpp-conformance-improvements.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ struct S
55
55
bool b = S{} != S{};
56
56
```
57
57
58
-
This code is accepted by the Microsoft Visual Studio C++ compiler. This means that the compiler is more strict with programs such as:
58
+
The compiler accepts this code, which means that the compiler is more strict with code such as:
59
59
60
60
```c++
61
61
structS
@@ -67,7 +67,7 @@ struct S
67
67
bool b = S{} == S{};
68
68
```
69
69
70
-
In version 17.5 the previous program is accepted. In 17.6 it is rejected. To fix it, add `const` to `operator==` to remove the ambiguity. Or, add a corresponding `operator!=` to the definition as shown in the following example:
70
+
Version 17.5 of the compiler accepts this program. Version 17.6 of the compiler rejects it. To fix it, add `const` to `operator==` to remove the ambiguity. Or, add a corresponding `operator!=` to the definition as shown in the following example:
71
71
72
72
```cpp
73
73
structS
@@ -82,7 +82,7 @@ bool b = S{} == S{};
82
82
83
83
The previous program is accepted by the Microsoft Visual Studio C++ compiler versions 17.5 and 17.6, and calls `S::operator==` in both versions.
84
84
85
-
The general programming model outlined in P2468R2 is that if there is a corresponding `operator!=` for a type, it will typically suppress the rewrite behavior. Adding a corresponding `operator!=` is the suggested fix for code that previously compiled in C++17. For more information, see [Programming Model](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2468r2.html#programming-model).
85
+
The general programming model outlined in P2468R2 is that if there's a corresponding `operator!=` for a type, it will typically suppress the rewrite behavior. Adding a corresponding `operator!=` is the suggested fix for code that previously compiled in C++17. For more information, see [Programming Model](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2468r2.html#programming-model).
86
86
87
87
## <aname="improvements_174"></a> Conformance improvements in Visual Studio 2022 version 17.4
88
88
@@ -132,7 +132,7 @@ enum Changed
132
132
133
133
In versions of Visual Studio before Visual Studio 2022 version 17.4, the C++ compiler didn't correctly model the types of enumerators. It could assume an incorrect type in enumerations without a fixed underlying type before the closing brace of the enumeration. Under [`/Zc:enumTypes`](../build/reference/zc-enumtypes.md), the compiler now correctly implements the standard behavior.
134
134
135
-
The C++ Standard specifies that within an enumeration definition of no fixed underlying type, the types of enumerators are determined by their initializers. Or, for the enumerators with no initializer, by the type of the previous enumerator (accounting for overflow). Previously, such enumerators were always given the deduced type of the enumeration, with a placeholder for the underlying type (typically **`int`**).
135
+
The C++ Standard specifies that within an enumeration definition of no fixed underlying type, initializers determine the types of enumerators. Or, for the enumerators with no initializer, by the type of the previous enumerator (accounting for overflow). Previously, such enumerators were always given the deduced type of the enumeration, with a placeholder for the underlying type (typically **`int`**).
136
136
137
137
When enabled, the **`/Zc:enumTypes`** option is a potential source and binary breaking change. It's off by default, and not enabled by **`/permissive-`**, because the fix may affect binary compatibility. Some enumeration types change size when the conformant fix is enabled. Certain Windows SDK headers include such enumeration definitions.
138
138
@@ -326,9 +326,9 @@ void f()
326
326
327
327
Visual Studio 2022 version 17.1 contains the following conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler.
328
328
329
-
### Detect ill-formed capture default in non-local lambda-expressions
329
+
### Detect ill-formed capture default in nonlocal lambda-expressions
330
330
331
-
The C++ Standard only allows a lambda expression in block scope to have a capture-default. In Visual Studio 2022 version 17.1 and later, the compiler detects when a capture default isn't allowed in a non-local lambda expression. It emits a new level 4 warning, C5253.
331
+
The C++ Standard only allows a lambda expression in block scope to have a capture-default. In Visual Studio 2022 version 17.1 and later, the compiler detects when a capture default isn't allowed in a nonlocal lambda expression. It emits a new level 4 warning, C5253.
332
332
333
333
This change is a source breaking change. It applies in any mode that uses the new lambda processor: **`/Zc:lambda`**, **`/std:c++20`**, or **`/std:c++latest`**.
334
334
@@ -341,7 +341,7 @@ In Visual Studio 2022 version 17.1 this code now emits an error:
341
341
342
342
auto incr = [=](int value) { return value + 1; };
343
343
344
-
// capture_default.cpp(3,14): error C5253: a non-local lambda cannot have a capture default
344
+
// capture_default.cpp(3,14): error C5253: a nonlocal lambda cannot have a capture default
345
345
// auto incr = [=](int value) { return value + 1; };
346
346
// ^
347
347
```
@@ -375,7 +375,7 @@ int main(void)
375
375
// C4113: 'int (__cdecl *)(char *)' differs in parameter lists from 'int (__cdecl *)(int)'
376
376
```
377
377
378
-
### Error on a non-dependent `static_assert`
378
+
### Error on a nondependent `static_assert`
379
379
380
380
In Visual Studio 2022 version 17.1 and later, if the expression associated with a `static_assert` isn't a dependent expression, the compiler evaluates the expression as soon as it's parsed. If the expression evaluates to `false`, the compiler emits an error. Previously, if the `static_assert` was within the body of a function template (or within the body of a member function of a class template), the compiler wouldn't perform this analysis.
0 commit comments