Skip to content

Commit be25fe4

Browse files
TylerMSFTTylerMSFT
authored andcommitted
acrolin
1 parent 8c989d9 commit be25fe4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/overview/cpp-conformance-improvements.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct S
5555
bool b = S{} != S{};
5656
```
5757

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:
5959

6060
```c++
6161
struct S
@@ -67,7 +67,7 @@ struct S
6767
bool b = S{} == S{};
6868
```
6969

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:
7171

7272
```cpp
7373
struct S
@@ -82,7 +82,7 @@ bool b = S{} == S{};
8282

8383
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.
8484

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).
8686

8787
## <a name="improvements_174"></a> Conformance improvements in Visual Studio 2022 version 17.4
8888

@@ -132,7 +132,7 @@ enum Changed
132132
133133
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.
134134
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`**).
136136
137137
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.
138138
@@ -326,9 +326,9 @@ void f()
326326

327327
Visual Studio 2022 version 17.1 contains the following conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler.
328328

329-
### Detect ill-formed capture default in non-local lambda-expressions
329+
### Detect ill-formed capture default in nonlocal lambda-expressions
330330

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.
332332

333333
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`**.
334334

@@ -341,7 +341,7 @@ In Visual Studio 2022 version 17.1 this code now emits an error:
341341

342342
auto incr = [=](int value) { return value + 1; };
343343

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
345345
// auto incr = [=](int value) { return value + 1; };
346346
// ^
347347
```
@@ -375,7 +375,7 @@ int main(void)
375375
// C4113: 'int (__cdecl *)(char *)' differs in parameter lists from 'int (__cdecl *)(int)'
376376
```
377377
378-
### Error on a non-dependent `static_assert`
378+
### Error on a nondependent `static_assert`
379379
380380
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.
381381

0 commit comments

Comments
 (0)