Skip to content

Commit 4714d83

Browse files
committed
Merging changes synced from https://github.com/MicrosoftDocs/cpp-docs-pr (branch live)
2 parents 3dc8003 + 8bd1054 commit 4714d83

24 files changed

+968
-113
lines changed

docs/overview/cpp-conformance-improvements-2019.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,16 @@ To avoid the errors, insert a space in the offending line before the final angle
6666

6767
### References to types with mismatched cv-qualifiers
6868

69-
Previously, MSVC allowed direct binding of a reference from a type with mismatched cv-qualifiers below the top level. This binding could allow modification of supposedly const data referred to by the reference. The compiler now creates a temporary, as required by the standard. In Visual Studio 2017, the following code compiles without warnings. In Visual Studio 2019, the compiler raises warning C4172:
69+
>[!Note]
70+
> This change only affects Visual Studio 2019 versions 16.0 through 16.8. It was reverted starting in Visual Studio 2019 version 16.9
71+
72+
Previously, MSVC allowed direct binding of a reference from a type with mismatched cv-qualifiers below the top level. This binding could allow modification of supposedly const data referred to by the reference.
73+
74+
The compiler for Visual Studio 2019 versions 16.0 through 16.8 instead creates a temporary, as was required by the standard at that time. Later, the standard retroactively changed making the previous behavior of Visual Studio 2017 and earlier correct, and the behavior of Visual Studio 2019 version 16.0 through 16.8 wrong. Consequently, this change was reverted starting in Visual Studio 2019 version 16.9.
75+
76+
See [Similar types and reference binding](#similar-types-and-reference-binding) for a related change.
77+
78+
As an example, in Visual Studio 2017, the following code compiles without warnings. In Visual Studio 2019 versions 16.0 through 16.8, the compiler raises warning C4172. Starting with Visual Studio 2019 version 16.9, the code once again compiles without warnings:
7079

7180
```cpp
7281
struct X
@@ -2067,10 +2076,14 @@ With this change, a destructor is also potentially throwing if it has a virtual
20672076

20682077
### Similar types and reference binding
20692078

2070-
Core Working Group issue [CWG 2352](https://wg21.link/cwg2352) deals with an inconsistency between the reference binding rules and changes to type similarity. The inconsistency was introduced in earlier Defect Reports (such as [CWG 330](https://wg21.link/cwg330)). With this change, code that previously bound a reference to a temporary may now bind directly when the types involved differ only by cv-qualifiers.
2079+
Core Working Group issue [CWG 2352](https://wg21.link/cwg2352) deals with an inconsistency between the reference binding rules and changes to type similarity. The inconsistency was introduced in earlier Defect Reports (such as [CWG 330](https://wg21.link/cwg330)). This affected Visual Studio 2019 versions 16.0 through 16.8.
2080+
2081+
With this change, starting in Visual Studio 2019 version 16.9, code that previously bound a reference to a temporary in Visual Studio 2019 version 16.0 throught 16.8 may now bind directly when the types involved differ only by cv-qualifiers.
20712082

20722083
Visual Studio 2019 version 16.9 implements the changed behavior in all **`/std`** compiler modes. It's potentially a source breaking change.
20732084

2085+
See [References to types with mismatched cv-qualifiers](#references-to-types-with-mismatched-cv-qualifiers) for a related change.
2086+
20742087
This sample shows the changed behavior:
20752088

20762089
```cpp

docs/standard-library/common-view-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ For a description of the following entries, see [View class characteristics](vie
3232
| **Range adaptor** | [`views::common`](range-adaptors.md#common) |
3333
| **Underlying range** | Must satisfy [`forward_range`](range-concepts.md#forward_range) or higher |
3434
| **Element type** | Same as the underlying range |
35-
| **View iterator category** | Supports `forward_range` or [`random_access_range`](range-concepts.md#random_access_range) when the underlying range satisfies `random_access_range` and [`sized_range`](range-concepts.md#sized_range) |
35+
| **View iterator category** | `forward_range` or [`random_access_range`](range-concepts.md#random_access_range) when the underlying range satisfies `random_access_range` and [`sized_range`](range-concepts.md#sized_range) |
3636
| **Sized** | Only if the underlying range satisfies [`sized_range`](range-concepts.md#sized_range) |
3737
| **Is `const`-iterable** | Only if the underlying range is `const` iterable |
3838
| **Common range** | Yes |

docs/standard-library/drop-while-view-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ For a description of the following entries, see [View class characteristics](vie
3636
| Characteristic | Description |
3737
|--|--|
3838
| **Range adaptor** | [`views::drop_while`](range-adaptors.md#drop_while) |
39-
| **Underlying range** | Must satisfy [`forward_range`](range-concepts.md#forward_range) or higher and the underlying range's iterators must model `sized_sentinel_for` |
39+
| **Underlying range** | Must satisfy [`forward_range`](range-concepts.md#forward_range) or higher and the underlying range's iterators must model [`sized_sentinel_for`](iterator-concepts.md#sized_sentinel_for) |
4040
| **Element type** | Same as the underlying range |
4141
| **View iterator category** | Same as the underlying range |
4242
| **Sized** | Only if the underlying range satisfies [`random_access_range`](range-concepts.md#random_access_range) |

docs/standard-library/empty-view-class.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ For a description of the following entries, see [View class characteristics](vie
3232
| **Range adaptor** | [`views::empty`](range-adaptors.md#empty) |
3333
| **Underlying range** | None |
3434
| **Element type** | As specified when the `empty_view` is created |
35-
| **View iterator category** | Supports `contiguous_range` |
35+
| **View iterator category** | `contiguous_range` |
3636
| **Sized** | Yes. Always returns 0 |
3737
| **Is `const`-iterable** | Yes |
3838
| **Common range** | Yes |
@@ -82,7 +82,7 @@ inline constexpr empty_view<T> empty{};
8282
### Parameters
8383

8484
*`T`*\
85-
The type of the underlying element, of which there are none.
85+
The type of the underlying element, of which there is none.
8686

8787
### Remarks
8888

docs/standard-library/filter-view-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ For a description of the following entries, see [View class characteristics](vie
3535
| **Range adaptor** | [`views::filter`](range-adaptors.md#filter) |
3636
| **Underlying range** | Must satisfy [`input_range`](range-concepts.md#input_range) or higher |
3737
| **Element type** | Same as the underlying range |
38-
| **View iterator category** | Supports `input_range`, [`forward_range`](range-concepts.md#forward_range), or [`bidirectional_range`](range-concepts.md#bidirectional_range) depending on the underlying range |
38+
| **View iterator category** | `input_range`, [`forward_range`](range-concepts.md#forward_range), or [`bidirectional_range`](range-concepts.md#bidirectional_range) depending on the underlying range |
3939
| **Sized** | No |
4040
| **Is `const`-iterable** | No |
4141
| **Common range** | Only if the underlying range satisfies [`common_range`](range-concepts.md#common_range) |

0 commit comments

Comments
 (0)