Skip to content

Repo sync for protected CLA branch #4346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
be20e45
structure for range iterators
Sep 27, 2022
3a59991
draft
Sep 30, 2022
83b770e
fix merge conflicts
Dec 2, 2022
4c8221e
match incoming changes
Dec 2, 2022
f38bdee
match incoming changes
Dec 2, 2022
2da8fd6
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Dec 2, 2022
36ece4e
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Dec 5, 2022
d19d436
draft
Dec 9, 2022
ed23f24
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Dec 9, 2022
1b9f5d9
draft
Dec 10, 2022
26907b5
draft
Dec 14, 2022
6be8d4b
add sentinel_for and sized_sentinel_for
Dec 14, 2022
d4f5dad
draft
Dec 14, 2022
d77c253
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Dec 15, 2022
d528729
draft
Dec 15, 2022
6dd32c2
draft
Dec 15, 2022
4fc5411
acrolinx
Dec 15, 2022
2b9467f
fix missing codefence
Dec 15, 2022
23b7ced
fix link
Dec 15, 2022
ae7ab66
add diagrams and crosslink iterator concepts to definitions
Dec 16, 2022
e8d2e60
adjust image size
Dec 16, 2022
d403e86
size
Dec 16, 2022
f6240b1
size
Dec 16, 2022
e961eeb
line up better
Dec 16, 2022
8a74742
force rebuild
Dec 16, 2022
eecf89e
force rebuild
Dec 16, 2022
f614a95
edits
Dec 19, 2022
b18de10
try to make table column narrower
Dec 19, 2022
4819078
last tweak
Dec 19, 2022
5716408
Merge pull request #4702 from TylerMSFT/ranges-iterators
Jak-MS Dec 20, 2022
f6569dc
clarify versions that a change applies to
Dec 20, 2022
2b26d13
tech review
Dec 20, 2022
0967423
Merge pull request #4726 from TylerMSFT/conformance
prmerger-automator[bot] Dec 20, 2022
1b7847d
fix title
Dec 21, 2022
eba28f0
Merge pull request #4728 from TylerMSFT/fixtitle
prmerger-automator[bot] Dec 21, 2022
8bd1054
Merge pull request #4730 from MicrosoftDocs/main
huypub Dec 21, 2022
4714d83
Merging changes synced from https://github.com/MicrosoftDocs/cpp-docs…
opbld16 Dec 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions docs/overview/cpp-conformance-improvements-2019.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,16 @@ To avoid the errors, insert a space in the offending line before the final angle

### References to types with mismatched cv-qualifiers

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:
>[!Note]
> This change only affects Visual Studio 2019 versions 16.0 through 16.8. It was reverted starting in Visual Studio 2019 version 16.9

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

See [Similar types and reference binding](#similar-types-and-reference-binding) for a related change.

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:

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

### Similar types and reference binding

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

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.

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

See [References to types with mismatched cv-qualifiers](#references-to-types-with-mismatched-cv-qualifiers) for a related change.

This sample shows the changed behavior:

```cpp
Expand Down
2 changes: 1 addition & 1 deletion docs/standard-library/common-view-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For a description of the following entries, see [View class characteristics](vie
| **Range adaptor** | [`views::common`](range-adaptors.md#common) |
| **Underlying range** | Must satisfy [`forward_range`](range-concepts.md#forward_range) or higher |
| **Element type** | Same as the underlying range |
| **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) |
| **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) |
| **Sized** | Only if the underlying range satisfies [`sized_range`](range-concepts.md#sized_range) |
| **Is `const`-iterable** | Only if the underlying range is `const` iterable |
| **Common range** | Yes |
Expand Down
2 changes: 1 addition & 1 deletion docs/standard-library/drop-while-view-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ For a description of the following entries, see [View class characteristics](vie
| Characteristic | Description |
|--|--|
| **Range adaptor** | [`views::drop_while`](range-adaptors.md#drop_while) |
| **Underlying range** | Must satisfy [`forward_range`](range-concepts.md#forward_range) or higher and the underlying range's iterators must model `sized_sentinel_for` |
| **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) |
| **Element type** | Same as the underlying range |
| **View iterator category** | Same as the underlying range |
| **Sized** | Only if the underlying range satisfies [`random_access_range`](range-concepts.md#random_access_range) |
Expand Down
4 changes: 2 additions & 2 deletions docs/standard-library/empty-view-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For a description of the following entries, see [View class characteristics](vie
| **Range adaptor** | [`views::empty`](range-adaptors.md#empty) |
| **Underlying range** | None |
| **Element type** | As specified when the `empty_view` is created |
| **View iterator category** | Supports `contiguous_range` |
| **View iterator category** | `contiguous_range` |
| **Sized** | Yes. Always returns 0 |
| **Is `const`-iterable** | Yes |
| **Common range** | Yes |
Expand Down Expand Up @@ -82,7 +82,7 @@ inline constexpr empty_view<T> empty{};
### Parameters

*`T`*\
The type of the underlying element, of which there are none.
The type of the underlying element, of which there is none.

### Remarks

Expand Down
2 changes: 1 addition & 1 deletion docs/standard-library/filter-view-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ For a description of the following entries, see [View class characteristics](vie
| **Range adaptor** | [`views::filter`](range-adaptors.md#filter) |
| **Underlying range** | Must satisfy [`input_range`](range-concepts.md#input_range) or higher |
| **Element type** | Same as the underlying range |
| **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 |
| **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 |
| **Sized** | No |
| **Is `const`-iterable** | No |
| **Common range** | Only if the underlying range satisfies [`common_range`](range-concepts.md#common_range) |
Expand Down
Loading