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
+9-11Lines changed: 9 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -519,7 +519,7 @@ In conformance mode (enabled by [/permissive-](../build/reference/permissive-sta
519
519
520
520
This can lead to different warning diagnostics being generated, and behavior differences for arithmetic operations performed on literals.
521
521
522
-
The following example shows the behavior prior to Visual Studio 2019, version 16.4. The `i` variable is of type **unsigned int** and therefore the warning is raised. The high-order bits of the variable `j` are set to 0.
522
+
The following example shows the new behavior in Visual Studio 2019, version 16.4. The `i` variable is of type **unsigned int** and therefore the warning is raised. The high-order bits of the variable `j` are set to 0.
523
523
524
524
```cpp
525
525
void f(int r) {
@@ -528,7 +528,7 @@ void f(int r) {
528
528
}
529
529
```
530
530
531
-
The following example demonstrates the new behavior:
531
+
The following example demonstrates how to keep the old behavior and thus avoid the warnings and run-time behavior change:
532
532
533
533
```cpp
534
534
voidf(int r) {
@@ -546,7 +546,7 @@ template<typename T>
546
546
void f(T* buffer, int size, int& size_read);
547
547
548
548
template<typename T, int Size>
549
-
void f(T(&buffer)[Size], int& Size) //C7576: declaration of 'Size' shadows a template parameter
549
+
void f(T(&buffer)[Size], int& Size) // error C7576: declaration of 'Size' shadows a template parameter
### Changes to compiler-provided comparison operators
599
599
600
-
In compliance with *over.match/9* the compiler will no longer rewrite expressions with `operator==` if they involve a return type that is not a **bool**. The following code now produces *error C2088: '!=': illegal for struct*:
600
+
The MSVC compiler now implements the following changes to comparison operators per [P1630R1](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1630r1.html) when the [/std:c++latest](../build/reference/std-specify-language-standard-version.md) option is enabled:
601
+
602
+
The compiler will no longer rewrite expressions with `operator==` if they involve a return type that is not a **bool**. The following code now produces *error C2088: '!=': illegal for struct*:
### Defaulted comparison operator in union-like classes
634
-
635
-
In compliance with *class.compare.default/2* the compiler will no longer define a defaulted comparison operator if it is a member of a union-like class. The following example now produces *C2120: 'void' illegal with all types*:
635
+
The compiler will no longer define a defaulted comparison operator if it is a member of a union-like class. The following example now produces *C2120: 'void' illegal with all types*:
### Defaulted comparison operator for classes with a reference member
668
-
669
-
In compliance with *class.compare.default/2* the compiler will no longer define a defaulted comparison operator if the class contains a reference member. The following code now produces *error C2120: 'void' illegal with all types*:
667
+
The compiler will no longer define a defaulted comparison operator if the class contains a reference member. The following code now produces *error C2120: 'void' illegal with all types*:
0 commit comments