Skip to content

Commit 41270aa

Browse files
author
mikeblome
committed
fixes per review
1 parent 41636b6 commit 41270aa

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

docs/overview/cpp-conformance-improvements.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ In conformance mode (enabled by [/permissive-](../build/reference/permissive-sta
519519
520520
This can lead to different warning diagnostics being generated, and behavior differences for arithmetic operations performed on literals.
521521
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.
523523
524524
```cpp
525525
void f(int r) {
@@ -528,7 +528,7 @@ void f(int r) {
528528
}
529529
```
530530

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

533533
```cpp
534534
void f(int r) {
@@ -546,7 +546,7 @@ template<typename T>
546546
void f(T* buffer, int size, int& size_read);
547547
548548
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
550550
{
551551
return f(buffer, Size, Size);
552552
}
@@ -595,9 +595,11 @@ struct my_is_fundamental<S> : std::true_type { };
595595
static_assert(my_is_fundamental<S>::value, "fail");
596596
```
597597
598-
### Expressions with operator==
598+
### Changes to compiler-provided comparison operators
599599
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*:
601603
602604
```cpp
603605
struct U {
@@ -630,9 +632,7 @@ bool neq(const S& lhs, const S& rhs) {
630632
}
631633
```
632634
633-
### 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*:
636636
637637
```cpp
638638
#include <compare>
@@ -664,9 +664,7 @@ bool lt(const S& lhs, const S& rhs) {
664664
}
665665
```
666666
667-
### 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*:
670668
671669
```cpp
672670
#include <compare>

0 commit comments

Comments
 (0)