From 2df807a4abaad7650dee8eafc021c4e61f40fac7 Mon Sep 17 00:00:00 2001 From: Taojunshen Date: Wed, 20 Oct 2021 01:43:13 +0800 Subject: [PATCH] 10/19/2021 AM Publish (#3846) * add new classes: ambiguous_local_time & nonexistent_local_time * acrolinx * fix links * finish descriptions * fix more links * smoothing out * proofing * add some better linking * tune description * update descriptions * needed to update local-info-struct.md to reflect changes to descriptions for nonexistent and ambiguous * add chrono functions * rounding out duration links * Add documentation for IntelliSense linter for C++ (#3821) * Add first draft of linter check documentation * WIP overview. Signed-off-by: Kyle Reed * Update toc. First draft of the linter overview. * Add screenshots, move files, code samples are stand-alone. Signed-off-by: Kyle Reed * Style and Acrolinx grammar checker pass * Add missing Options cues for checks * Update to use latest option names Co-authored-by: 3836425+corob-msft@users.noreply.github.com * connecting duration up to it's non-member pieces and doing some general updates * fix links * cleanup * Split out VS2019 content for linter (#3824) * Update working-with-project-properties.md * cleanup * cleanup * cleanup * cleanup * cleanup * cleanup * cleanup * fix function signature * fix line ending * remove duplicate * Address /profile issues per Paddy McD (#3834) * Fixed documentation that destroy dialogs * Update void-cpp for cpp-docs 3441 Reported in MicrosoftDocs/cpp-docs/issues/3441 Clarify kinds of class member where you can't use `void*`. Fix styles. Acrolinx a few things. * More clarity on void pointers to members * zoned_traits (#3831) * add zoned_traits * draft clock_cast and clock_time_conversion * first draft * draft * draft * fix heading * cleanup * add tzdb and tzdb-list * draft * draft * pull examples * draft cleanup * acrolinx * draft cleanup * draft cleanup * incorp tech review * tech review * cleanup * cleanup * acrolinx * fix casing * add example descriptions * wording * last adjustments * wording Co-authored-by: TylerMSFT * Update 16.1 conformance per J Emmett * Update docs/error-messages/compiler-errors-2/compiler-error-c2666.md * Fix typo in page title * Fix TOC schema before VS2022 changes Co-authored-by: TylerMSFT Co-authored-by: Colin Robertson Co-authored-by: Kyle Reed Co-authored-by: Chai Wei Jie Co-authored-by: opbld15 Co-authored-by: PRMerger19 Co-authored-by: Laura Brenner <90344170+laurabren@users.noreply.github.com> Co-authored-by: Courtney Wales <62625502+Court72@users.noreply.github.com> Co-authored-by: Andrea Courtright <74212614+v-andreaco@users.noreply.github.com> Co-authored-by: PRMerger15 Co-authored-by: opbld16 Co-authored-by: PRMerger8 Co-authored-by: Anju Del Moral Gonzalez Co-authored-by: opbld17 Co-authored-by: Tyler Whitney Co-authored-by: Miya Natsuhara <46756417+mnatsuhara@users.noreply.github.com> Co-authored-by: Kristine Toliver --- docs/_breadcrumb/toc.yml | 1 + docs/assembler/toc.yml | 1 + docs/atl-mfc-shared/toc.yml | 1 + docs/atl/toc.yml | 1 + docs/build-insights/toc.yml | 1 + docs/build/toc.yml | 1 + docs/c-language/toc.yml | 1 + docs/c-runtime-library/toc.yml | 1 + docs/code-quality/toc.yml | 1 + docs/cpp/toc.yml | 9 +-- docs/cppcx/toc.yml | 1 + docs/cross-platform/toc.yml | 1 + docs/data/toc.yml | 1 + docs/dotnet/toc.yml | 1 + .../compiler-errors-2/compiler-error-c2666.md | 48 ++++++++++++++- docs/error-messages/toc.yml | 1 + docs/extensions/toc.yml | 1 + docs/get-started/breadcrumb/toc.yml | 1 + docs/ide/toc.yml | 1 + docs/intrinsics/toc.yml | 1 + docs/linux/toc.yml | 1 + docs/mfc/toc.yml | 1 + docs/overview/cpp-conformance-improvements.md | 60 ++++++++++++++++++- docs/overview/toc.yml | 1 + docs/parallel/toc.yml | 1 + docs/porting/toc.yml | 1 + docs/preprocessor/toc.yml | 1 + docs/sanitizers/toc.yml | 1 + docs/standard-library/file-clock-class.md | 4 +- docs/standard-library/toc.yml | 1 + docs/text/toc.yml | 1 + docs/windows/toc.yml | 1 + 32 files changed, 139 insertions(+), 10 deletions(-) diff --git a/docs/_breadcrumb/toc.yml b/docs/_breadcrumb/toc.yml index 08c2231e264..efaed4b8a9e 100644 --- a/docs/_breadcrumb/toc.yml +++ b/docs/_breadcrumb/toc.yml @@ -1,3 +1,4 @@ +items: - name: Docs tocHref: / topicHref: / diff --git a/docs/assembler/toc.yml b/docs/assembler/toc.yml index ddda8b8fef5..8f8b923a9c3 100644 --- a/docs/assembler/toc.yml +++ b/docs/assembler/toc.yml @@ -1,3 +1,4 @@ +items: - name: Compiler intrinsics and assembly language href: ../intrinsics/index.yml - name: Compiler intrinsics diff --git a/docs/atl-mfc-shared/toc.yml b/docs/atl-mfc-shared/toc.yml index dbc065eaca8..39bdbdcbe94 100644 --- a/docs/atl-mfc-shared/toc.yml +++ b/docs/atl-mfc-shared/toc.yml @@ -1,3 +1,4 @@ +items: - name: ATL-MFC shared classes href: ../atl-mfc-shared/atl-mfc-shared-classes.md - name: ATL-MFC concepts diff --git a/docs/atl/toc.yml b/docs/atl/toc.yml index a980a764b53..931fbffd523 100644 --- a/docs/atl/toc.yml +++ b/docs/atl/toc.yml @@ -1,3 +1,4 @@ +items: - name: Active Template Library (ATL) href: atl-com-desktop-components.md - name: Active Template Library (ATL) concepts diff --git a/docs/build-insights/toc.yml b/docs/build-insights/toc.yml index 0c49fd52832..30f047a6e9d 100644 --- a/docs/build-insights/toc.yml +++ b/docs/build-insights/toc.yml @@ -1,3 +1,4 @@ +items: - name: "C++ Build Insights" href: ../build-insights/index.yml - name: "Get started with C++ Build Insights" diff --git a/docs/build/toc.yml b/docs/build/toc.yml index f9533249d4b..127c19fe656 100644 --- a/docs/build/toc.yml +++ b/docs/build/toc.yml @@ -1,3 +1,4 @@ +items: - name: Projects and build systems href: ../build/projects-and-build-systems-cpp.md - name: Visual Studio projects - C++ diff --git a/docs/c-language/toc.yml b/docs/c-language/toc.yml index 854cf0ed733..bdec148f7a9 100644 --- a/docs/c-language/toc.yml +++ b/docs/c-language/toc.yml @@ -1,3 +1,4 @@ +items: - name: C language documentation href: ../c-language/index.yml - name: C language reference diff --git a/docs/c-runtime-library/toc.yml b/docs/c-runtime-library/toc.yml index 722c04c1a67..fbcbac882ff 100644 --- a/docs/c-runtime-library/toc.yml +++ b/docs/c-runtime-library/toc.yml @@ -1,3 +1,4 @@ +items: - name: C runtime library (CRT) reference href: ../c-runtime-library/c-run-time-library-reference.md - name: CRT library features diff --git a/docs/code-quality/toc.yml b/docs/code-quality/toc.yml index 244f5c7f3ec..8b4267b424c 100644 --- a/docs/code-quality/toc.yml +++ b/docs/code-quality/toc.yml @@ -1,3 +1,4 @@ +items: - name: Code analysis documentation href: ../code-quality/index.yml - name: Overview diff --git a/docs/cpp/toc.yml b/docs/cpp/toc.yml index 83f0eeb0239..a41c3e256cc 100644 --- a/docs/cpp/toc.yml +++ b/docs/cpp/toc.yml @@ -1,3 +1,4 @@ +items: - name: C++ language documentation href: ../cpp/index.yml - name: C++ language reference @@ -69,9 +70,9 @@ href: ../cpp/void-cpp.md - name: bool href: ../cpp/bool-cpp.md - - name: false + - name: "false" href: ../cpp/false-cpp.md - - name: true + - name: "true" href: ../cpp/true-cpp.md - name: char, wchar_t, char8_t, char16_t, char32_t href: ../cpp/char-wchar-t-char16-t-char32-t.md @@ -419,8 +420,6 @@ href: ../cpp/special-member-functions.md - name: Static members href: ../cpp/static-members-cpp.md - - name: C++ classes as value types - href: ../cpp/value-types-modern-cpp.md - name: User-defined type conversions href: ../cpp/user-defined-type-conversions-cpp.md - name: Mutable data members @@ -481,8 +480,6 @@ href: ../cpp/how-to-create-and-use-weak-ptr-instances.md - name: "How to: Create and use CComPtr and CComQIPtr instances" href: ../cpp/how-to-create-and-use-ccomptr-and-ccomqiptr-instances.md - - name: Pimpl for compile-time encapsulation - href: ../cpp/pimpl-for-compile-time-encapsulation-modern-cpp.md - name: Exception handling in C++ items: - name: Exception handling in C++ diff --git a/docs/cppcx/toc.yml b/docs/cppcx/toc.yml index 4d5d0228392..d4171f81869 100644 --- a/docs/cppcx/toc.yml +++ b/docs/cppcx/toc.yml @@ -1,3 +1,4 @@ +items: - name: UWP development href: ../cppcx/universal-windows-apps-cpp.md - name: C++/CX language reference diff --git a/docs/cross-platform/toc.yml b/docs/cross-platform/toc.yml index af14bd391d1..4446b6541ff 100644 --- a/docs/cross-platform/toc.yml +++ b/docs/cross-platform/toc.yml @@ -1,3 +1,4 @@ +items: - name: Cross-platform mobile development with C++ href: ../cross-platform/index.yml - name: Overview diff --git a/docs/data/toc.yml b/docs/data/toc.yml index e53e0548b2c..aea9e6bb11e 100644 --- a/docs/data/toc.yml +++ b/docs/data/toc.yml @@ -1,3 +1,4 @@ +items: - name: Data access in Visual C++ href: ../data/data-access-in-cpp.md - name: Data access programming (MFC-ATL) diff --git a/docs/dotnet/toc.yml b/docs/dotnet/toc.yml index 37bc30df4bc..a6cb484b9c7 100644 --- a/docs/dotnet/toc.yml +++ b/docs/dotnet/toc.yml @@ -1,3 +1,4 @@ +items: - name: .NET programming with C++/CLI href: ../dotnet/dotnet-programming-with-cpp-cli-visual-cpp.md - name: "Walkthrough: Compile a C++/CLI program that targets the CLR" diff --git a/docs/error-messages/compiler-errors-2/compiler-error-c2666.md b/docs/error-messages/compiler-errors-2/compiler-error-c2666.md index 4e4b87236a5..7307e34bb41 100644 --- a/docs/error-messages/compiler-errors-2/compiler-error-c2666.md +++ b/docs/error-messages/compiler-errors-2/compiler-error-c2666.md @@ -1,7 +1,7 @@ --- description: "Learn more about: Compiler Error C2666" title: "Compiler Error C2666" -ms.date: "11/04/2016" +ms.date: 10/18/2021 f1_keywords: ["C2666"] helpviewer_keywords: ["C2666"] ms.assetid: 78364d15-c6eb-439a-9088-e04a0176692b @@ -30,6 +30,52 @@ int main() { } ``` +This error can be generated as a result of compiler conformance work that was done for Visual Studio 2019 version 16.1: + +- A conversion that promotes an enumeration whose underlying type is fixed to its underlying type is better than one that promotes to the promoted underlying type, if the two are different. + +The following example demonstrates how compiler behavior changes in Visual Studio 2019 version 16.1 and later versions: + +```cpp +#include + +enum E : unsigned char { e }; + +int f(unsigned int) +{ + return 1; +} + +int f(unsigned char) +{ + return 2; +} + +struct A {}; +struct B : public A {}; + +int f(unsigned int, const B&) +{ + return 3; +} + +int f(unsigned char, const A&) +{ + return 4; +} + +int main() +{ + // Calls f(unsigned char) in 16.1 and later. Called f(unsigned int) in earlier versions. + // The conversion from 'E' to the fixed underlying type 'unsigned char' is better than the + // conversion from 'E' to the promoted type 'unsigned int'. + f(e); + + // Error C2666. This call is ambiguous, but previously called f(unsigned int, const B&). + f(e, B{}); +} +``` + This error can also be generated as a result of compiler conformance work that was done for Visual Studio .NET 2003: - binary operators and user-defined conversions to pointer types diff --git a/docs/error-messages/toc.yml b/docs/error-messages/toc.yml index 9597c9b39bd..2bb7407359e 100644 --- a/docs/error-messages/toc.yml +++ b/docs/error-messages/toc.yml @@ -1,3 +1,4 @@ +items: - name: C/C++ Compiler and build tools errors and warnings href: compiler-errors-1/c-cpp-build-errors.md - name: BSCMAKE errors and warnings diff --git a/docs/extensions/toc.yml b/docs/extensions/toc.yml index c865a10c743..5e19ed829dc 100644 --- a/docs/extensions/toc.yml +++ b/docs/extensions/toc.yml @@ -1,3 +1,4 @@ +items: - name: Component Extensions for .NET and UWP href: ../extensions/component-extensions-for-runtime-platforms.md - name: Tracking reference operator diff --git a/docs/get-started/breadcrumb/toc.yml b/docs/get-started/breadcrumb/toc.yml index fdc04e4ebb3..1185736d948 100644 --- a/docs/get-started/breadcrumb/toc.yml +++ b/docs/get-started/breadcrumb/toc.yml @@ -1,3 +1,4 @@ +items: - name: Docs tocHref: / topicHref: / diff --git a/docs/ide/toc.yml b/docs/ide/toc.yml index 54498e820e3..6a24a53a6bb 100644 --- a/docs/ide/toc.yml +++ b/docs/ide/toc.yml @@ -1,3 +1,4 @@ +items: - name: Read and write C++ code in Visual Studio expanded: true items: diff --git a/docs/intrinsics/toc.yml b/docs/intrinsics/toc.yml index e32b1d4e512..a6a4865d218 100644 --- a/docs/intrinsics/toc.yml +++ b/docs/intrinsics/toc.yml @@ -1,3 +1,4 @@ +items: - name: Compiler intrinsics and assembly language href: ../intrinsics/index.yml - name: Compiler intrinsics diff --git a/docs/linux/toc.yml b/docs/linux/toc.yml index a89016c2243..06e66952719 100644 --- a/docs/linux/toc.yml +++ b/docs/linux/toc.yml @@ -1,3 +1,4 @@ +items: - name: Linux with Visual Studio C++ documentation href: ../linux/index.yml - name: Download, install, and set up the Linux Development workload diff --git a/docs/mfc/toc.yml b/docs/mfc/toc.yml index 02b561d6969..b5010afabe1 100644 --- a/docs/mfc/toc.yml +++ b/docs/mfc/toc.yml @@ -1,3 +1,4 @@ +items: - name: MFC desktop applications href: mfc-desktop-applications.md - name: MFC concepts diff --git a/docs/overview/cpp-conformance-improvements.md b/docs/overview/cpp-conformance-improvements.md index b1de1b72097..907561ebe54 100644 --- a/docs/overview/cpp-conformance-improvements.md +++ b/docs/overview/cpp-conformance-improvements.md @@ -1,7 +1,7 @@ --- title: "C++ conformance improvements in Visual Studio 2019" description: "Microsoft C++ in Visual Studio is progressing toward full conformance with the C++20 language standard." -ms.date: 06/11/2021 +ms.date: 10/18/2021 ms.technology: "cpp-language" --- # C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2019 @@ -523,6 +523,58 @@ void f() { [P0329R4](https://wg21.link/p0329r4) (C++20) *Designated initialization* allows specific members to be selected in aggregate initialization by using the `Type t { .member = expr }` syntax. Requires **`/std:c++latest`** (or **`/std:c++20`** starting in Visual Studio 2019 version 16.11). +### Ranking of enum conversion to its fixed underlying type + +The compiler now ranks enum conversions according to [N4800](https://wg21.link/n4800) 11.3.3.2 Ranking implicit conversion sequences (4.2): + +- A conversion that promotes an enumeration whose underlying type is fixed to its underlying type is better than one that promotes to the promoted underlying type, if the two are different. + +This conversion ranking wasn't implemented correctly before Visual Studio 2019 version 16.1. The conforming behavior may change overload resolution behavior or expose an ambiguity where one previously was not detected. + +This compiler behavior change applies to all **`/std`** modes and is both a source and binary breaking change. + +The following example demonstrates how compiler behavior changes in 16.1 and later versions: + +```cpp +#include + +enum E : unsigned char { e }; + +int f(unsigned int) +{ + return 1; +} + +int f(unsigned char) +{ + return 2; +} + +struct A {}; +struct B : public A {}; + +int f(unsigned int, const B&) +{ + return 3; +} + +int f(unsigned char, const A&) +{ + return 4; +} + +int main() +{ + // Calls f(unsigned char) in 16.1 and later. Called f(unsigned int) in earlier versions. + // The conversion from 'E' to the fixed underlying type 'unsigned char' is better than the + // conversion from 'E' to the promoted type 'unsigned int'. + f(e); + + // Error C2666. This call is ambiguous, but previously called f(unsigned int, const B&). + f(e, B{}); +} +``` + ### New and updated standard library functions (C++20) - `starts_with()` and `ends_with()` for `basic_string` and `basic_string_view`. @@ -2462,6 +2514,12 @@ struct S { }; ``` +## Conformance improvements in Visual Studio 2019 version 16.11 + +### `/std:c++20` compiler mode + +Starting in Visual Studio 2019 version 16.11, the compiler now supports the [`/std:c++20`](../build/reference/std-specify-language-standard-version.md) compiler mode. Previously, C++20 features were available only in [`/std:c++latest`](../build/reference/std-specify-language-standard-version.md) mode in Visual Studio 2019. Features that originally required **`/std:c++latest`** mode now work in **`/std:c++20`** mode or later in the latest versions of Visual Studio. + ## See also [Microsoft C/C++ language conformance](visual-cpp-language-conformance.md) diff --git a/docs/overview/toc.yml b/docs/overview/toc.yml index b9a98c5c813..86ed81f17f4 100644 --- a/docs/overview/toc.yml +++ b/docs/overview/toc.yml @@ -1,3 +1,4 @@ +items: - name: Microsoft C/C++ in Visual Studio expanded: false items: diff --git a/docs/parallel/toc.yml b/docs/parallel/toc.yml index 216cb45722b..98a9fd0393a 100644 --- a/docs/parallel/toc.yml +++ b/docs/parallel/toc.yml @@ -1,3 +1,4 @@ +items: - name: Parallel programming in MSVC href: ../parallel/parallel-programming-in-visual-cpp.md - name: Auto-parallelization and auto-vectorization diff --git a/docs/porting/toc.yml b/docs/porting/toc.yml index a7b5fd478e3..f7492ec5269 100644 --- a/docs/porting/toc.yml +++ b/docs/porting/toc.yml @@ -1,3 +1,4 @@ +items: - name: Microsoft C++ Porting and Upgrade Guide href: ../porting/visual-cpp-porting-and-upgrading-guide.md - name: Upgrade projects from earlier versions diff --git a/docs/preprocessor/toc.yml b/docs/preprocessor/toc.yml index 1219c278cbc..a2121985ada 100644 --- a/docs/preprocessor/toc.yml +++ b/docs/preprocessor/toc.yml @@ -1,3 +1,4 @@ +items: - name: C/C++ preprocessor reference href: ../preprocessor/c-cpp-preprocessor-reference.md - name: Preprocessor diff --git a/docs/sanitizers/toc.yml b/docs/sanitizers/toc.yml index 42fc6f780ea..6ca9012f81a 100644 --- a/docs/sanitizers/toc.yml +++ b/docs/sanitizers/toc.yml @@ -1,3 +1,4 @@ +items: - name: "Code Sanitizers" href: ../sanitizers/index.yml - name: "AddressSanitizer" diff --git a/docs/standard-library/file-clock-class.md b/docs/standard-library/file-clock-class.md index 87db1fc9f3d..ebb53bbfff0 100644 --- a/docs/standard-library/file-clock-class.md +++ b/docs/standard-library/file-clock-class.md @@ -1,6 +1,6 @@ --- description: "Learn more about: file_clock class" -title: "fiie_clock class" +title: "file_clock class" ms.date: 08/19/2021 f1_keywords: ["chrono/std::chrono::file_clock", "chrono/std::chrono::file_clock::now", "chrono/std::chrono::file_clock::to_utc", "chrono/std::chrono::file_clock::from_utc", "chrono/std::chrono::file_clock::is_steady Constant"] --- @@ -177,4 +177,4 @@ A [time_point](time-point-class.md) object that represents the current time. [`system_clock` struct](system-clock-structure.md)\ [`tai_clock` class](tai-clock-class.md)\ [`utc_clock` class](utc-clock-class.md)\ -[Header Files Reference](cpp-standard-library-header-files.md) \ No newline at end of file +[Header Files Reference](cpp-standard-library-header-files.md) diff --git a/docs/standard-library/toc.yml b/docs/standard-library/toc.yml index 10ef23ae748..e312918bfcf 100644 --- a/docs/standard-library/toc.yml +++ b/docs/standard-library/toc.yml @@ -1,3 +1,4 @@ +items: - name: C++ Standard Library reference href: cpp-standard-library-reference.md - name: C++ Standard Library header files diff --git a/docs/text/toc.yml b/docs/text/toc.yml index f53a1e36a3c..ee0b2b3066a 100644 --- a/docs/text/toc.yml +++ b/docs/text/toc.yml @@ -1,3 +1,4 @@ +items: - name: Text and strings in MSVC href: ../text/text-and-strings-in-visual-cpp.md - name: Unicode and MBCS diff --git a/docs/windows/toc.yml b/docs/windows/toc.yml index 0b2d35565f1..40174d40848 100644 --- a/docs/windows/toc.yml +++ b/docs/windows/toc.yml @@ -1,3 +1,4 @@ +items: - name: Overview of Windows programming in C++ href: ../windows/overview-of-windows-programming-in-cpp.md - name: Desktop Applications in C++