From 061d5e0de883c5db70e388d70d8c02258d409da6 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 9 Sep 2025 15:10:05 -0700 Subject: [PATCH 01/62] Python 3.13.7. --- azure-devops/provision-image.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index a27553e32eb..3163b3e7716 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -42,7 +42,7 @@ foreach ($workload in $VisualStudioWorkloads) { $PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.5.2/PowerShell-7.5.2-win-x64.msi' $PowerShellArgs = @('/quiet', '/norestart') -$PythonUrl = 'https://www.python.org/ftp/python/3.13.6/python-3.13.6-amd64.exe' +$PythonUrl = 'https://www.python.org/ftp/python/3.13.7/python-3.13.7-amd64.exe' $PythonArgs = @('/quiet', 'InstallAllUsers=1', 'PrependPath=1', 'CompileAll=1', 'Include_doc=0') $CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_551.61_windows.exe' From d434553833f394133804173f3131a9e08445af60 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Tue, 9 Sep 2025 15:21:02 -0700 Subject: [PATCH 02/62] Update VS URL from 17 Preview Enterprise to 18 Insiders Community. --- azure-devops/provision-image.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index 3163b3e7716..d27cf236c4a 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -31,7 +31,7 @@ $VisualStudioWorkloads = @( 'Microsoft.VisualStudio.Component.Windows11SDK.26100' ) -$VisualStudioUrl = 'https://aka.ms/vs/17/pre/vs_enterprise.exe' +$VisualStudioUrl = 'https://aka.ms/vs/18/insiders/vs_Community.exe' $VisualStudioArgs = @('--quiet', '--norestart', '--wait', '--nocache') foreach ($workload in $VisualStudioWorkloads) { $VisualStudioArgs += '--add' From a1d4acaf6af0872f6de4a83bcb96c1f23c1a77af Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 10 Sep 2025 02:11:20 -0700 Subject: [PATCH 03/62] New pool. --- azure-devops/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-devops/config.yml b/azure-devops/config.yml index d377651872b..73a85b5230d 100644 --- a/azure-devops/config.yml +++ b/azure-devops/config.yml @@ -5,7 +5,7 @@ variables: - name: poolName - value: 'StlBuild-2025-08-12T1208-Pool' + value: 'StlBuild-2025-09-09T1526-Pool' readonly: true - name: poolDemands value: 'EnableSpotVM -equals false' From 9809bc4baa04f0b4efb75504878bb3201763cb44 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 02:53:01 -0700 Subject: [PATCH 04/62] Generalize to "Windows 11 SDK (10.0.26100) or later". VS is currently shipping 10.0.26100.4654, but the patch versions aren't significant to us. --- CMakeLists.txt | 6 +++--- README.md | 4 ++-- tests/utils/stl/test/tests.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5663853b04..18d23d91565 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ int main() {} ]=] WINDOWS_SDK_VERSION_CHECK) if(NOT WINDOWS_SDK_VERSION_CHECK) - message(FATAL_ERROR "The STL must be built with the Windows 11 SDK (10.0.26100.4188) or later. Make sure it's available by selecting it in the Individual Components tab of the VS Installer.") + message(FATAL_ERROR "The STL must be built with the Windows 11 SDK (10.0.26100) or later. Make sure it's available by selecting it in the Individual Components tab of the VS Installer.") endif() if(NOT DEFINED VCLIBS_TARGET_ARCHITECTURE) @@ -97,13 +97,13 @@ add_compile_definitions( _WIN32_WINNT=0x0A00 NTDDI_VERSION=NTDDI_WIN11_GE) if(STL_USE_ANALYZE) - # TRANSITION, Windows SDK 10.0.26100.4188 emits + # TRANSITION, Windows SDK 10.0.26100 emits # "warning C6553: The annotation for function 'LCMapStringEx' on _Param_(9) does not apply to a value type." # Reported as OS-40109504 "Windows SDK: incorrect SAL annotations on functions the STL uses". add_compile_options("$<$:/analyze:autolog-;/wd6553>") if(VCLIBS_TARGET_ARCHITECTURE STREQUAL "arm64ec") - # TRANSITION, Windows SDK 10.0.26100.4188 emits + # TRANSITION, Windows SDK 10.0.26100 emits # "warning C28301: No annotations for first declaration of 'meow'" # for various intrinsics when building for ARM64EC. add_compile_options("$<$:/wd28301>") diff --git a/README.md b/README.md index ebc700c0699..57510e7c9f5 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem # How To Build With The Visual Studio IDE 1. Install Visual Studio 2022 17.14.12 Preview 1 or later. - * Select "Windows 11 SDK (10.0.26100.4188)" in the VS Installer. + * Select "Windows 11 SDK (10.0.26100)" or later in the VS Installer. * Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer if you would like to build the ARM64/ARM64EC target. * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. @@ -159,7 +159,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem # How To Build With A Native Tools Command Prompt 1. Install Visual Studio 2022 17.14.12 Preview 1 or later. - * Select "Windows 11 SDK (10.0.26100.4188)" in the VS Installer. + * Select "Windows 11 SDK (10.0.26100)" or later in the VS Installer. * Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer if you would like to build the ARM64/ARM64EC target. * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. diff --git a/tests/utils/stl/test/tests.py b/tests/utils/stl/test/tests.py index f8762f1cb2d..9275572abec 100644 --- a/tests/utils/stl/test/tests.py +++ b/tests/utils/stl/test/tests.py @@ -258,7 +258,7 @@ def _handleEnvlst(self, litConfig): self.compileFlags.append('/arm64EC') self.linkFlags.append('/machine:arm64ec') - # TRANSITION, Windows SDK 10.0.26100.4188 emits + # TRANSITION, Windows SDK 10.0.26100 emits # "warning C28301: No annotations for first declaration of 'meow'" # for various intrinsics when building for ARM64EC. self.compileFlags.append('/wd28301') From 3e79f4f1f630b38f6da697a3cbaa0bc3c76e122a Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 03:16:32 -0700 Subject: [PATCH 05/62] Require MSVC Compiler 19.50 Preview 1. Using "MSVC Compiler" to clarify the 19.5x version stream, in contrast to the MSVC Build Tools 14.5x and the IDE 18.x. --- CMakeLists.txt | 4 ++-- stl/inc/yvals_core.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 18d23d91565..89bda7c09a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,8 @@ cmake_minimum_required(VERSION 3.31.0) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) project(msvc_standard_libraries LANGUAGES CXX) -if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.44.35214") - message(FATAL_ERROR "The STL must be built with VS 2022 17.14.12 Preview 1 or later.") +if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.50.35503") + message(FATAL_ERROR "The STL must be built with MSVC Compiler 19.50 Preview 1 or later.") endif() include(CheckCXXSourceCompiles) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index d6f55304d10..8289f0abe4b 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -925,8 +925,8 @@ _EMIT_STL_ERROR(STL1002, "Unexpected compiler version, expected CUDA 12.4 or new _EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 19.0.0 or newer."); #endif // ^^^ old Clang ^^^ #elif defined(_MSC_VER) -#if _MSC_VER < 1944 // Coarse-grained, not inspecting _MSC_FULL_VER -_EMIT_STL_ERROR(STL1001, "Unexpected compiler version, expected MSVC 19.44 or newer."); +#if _MSC_VER < 1950 // Coarse-grained, not inspecting _MSC_FULL_VER +_EMIT_STL_ERROR(STL1001, "Unexpected compiler version, expected MSVC Compiler 19.50 or newer."); #endif // ^^^ old MSVC ^^^ #else // vvv other compilers vvv // not attempting to detect other compilers From b45bf89dc361a6428a264c402c6c295fe520be0a Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 05:22:46 -0700 Subject: [PATCH 06/62] README.md: Reorganize architectures. + Don't repeat the "native desktop" limitation which was already mentioned. + Consistently mention x64 before x86. This reflects a mindset change for us. + Also mention ARM64EC. --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 57510e7c9f5..ed64fa41de5 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ soon as possible.) and fully ported libcxx to run under [lit][] using the various configurations/compilers we test internally. * Continuous Integration: **In progress.** We've set up Azure Pipelines to validate changes to the repository. -Currently, it builds the STL (native desktop for x86, x64, and ARM64). Also, it strictly verifies that all of our +Currently, it builds the STL for x64, x86, ARM64, and ARM64EC. Also, it strictly verifies that all of our files have been formatted with [clang-format][] and follow our other whitespace conventions. * Contribution Guidelines: **Coming soon.** Working on the STL's code involves following many rules. We have codebase @@ -170,13 +170,6 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem 3. Change directories to a location where you'd like a clone of this STL repository. 4. `git clone https://github.com/microsoft/STL.git --recurse-submodules` -To build the x86 target: - -1. Open an "x86 Native Tools Command Prompt for VS 2022 Preview". -2. Change directories to the previously cloned `STL` directory. -3. `cmake --preset x86` -4. `cmake --build --preset x86` - To build the x64 target (recommended): 1. Open an "x64 Native Tools Command Prompt for VS 2022 Preview". @@ -184,6 +177,13 @@ To build the x64 target (recommended): 3. `cmake --preset x64` 4. `cmake --build --preset x64` +To build the x86 target: + +1. Open an "x86 Native Tools Command Prompt for VS 2022 Preview". +2. Change directories to the previously cloned `STL` directory. +3. `cmake --preset x86` +4. `cmake --build --preset x86` + To build the ARM64 target: 1. `"C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" x64_arm64` @@ -253,7 +253,7 @@ C:\Users\username\Desktop>dumpbin /DEPENDENTS .\example.exe | findstr msvcp 2. Acquire [Python][] 3.13 or newer and have it on the `PATH` (or run it directly using its absolute or relative path). 3. Have LLVM's `bin` directory on the `PATH` (so `clang-cl.exe` is available). * We recommend selecting "C++ Clang tools for Windows" in the VS Installer. This will automatically add LLVM to the - `PATH` of the x86 and x64 Native Tools Command Prompts, and will ensure that you're using a supported version. + `PATH` of the x64 and x86 Native Tools Command Prompts, and will ensure that you're using a supported version. * Otherwise, use [LLVM's installer][] and choose to add LLVM to your `PATH` during installation. 4. Follow the instructions below. From 70ef671147d5e72da5877fc2abbda4d8c04cd567 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 06:37:24 -0700 Subject: [PATCH 07/62] README.md: Avoid suspicious long dashes. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ed64fa41de5..0d1ca4a0e11 100644 --- a/README.md +++ b/README.md @@ -422,7 +422,7 @@ python tests\utils\stl-lit\stl-lit.py ..\..\tests\std\tests\VSO_0000000_vector_a # Benchmarking -For performance-sensitive code – containers, algorithms, and the like – +For performance-sensitive code (e.g. containers and algorithms) you may wish to write and/or run benchmarks, and the STL team will likely run any benchmarks we do have in our PR process. Additionally, if you are writing a "performance improvement" PR, please add and run benchmarks From 973652052e8c34c6832d61f0b30057edb935f27e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 06:41:56 -0700 Subject: [PATCH 08/62] README.md: Update bincompat wording for VS 2026. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0d1ca4a0e11..22776458934 100644 --- a/README.md +++ b/README.md @@ -80,8 +80,8 @@ significantly more complicated and fragile. That is, there's a "complexity budge debugging checks. For example, we've extensively marked the STL with `[[nodiscard]]` attributes because this helps programmers avoid bugs. -* Compatibility: This includes binary compatibility and source compatibility. We're keeping VS 2022 binary-compatible -with VS 2015/2017/2019, which restricts what we can change in VS 2022 updates. (We've found that significant changes +* Compatibility: This includes binary compatibility and source compatibility. We're keeping VS 2026 binary-compatible +with VS 2015-2022, which restricts what we can change in VS 2026 updates. (We've found that significant changes are possible even though other changes are impossible, which we'll be documenting in our Contribution Guidelines soon.) While there are a few exceptions to this rule (e.g. if a feature is added to the Working Paper, we implement it, and then the feature is significantly changed before the International Standard is finalized, we reserve the right to break From 46271cc06c18bf2edff8b3c938dad608c49b6e25 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 07:01:23 -0700 Subject: [PATCH 09/62] README.md: (major improvement) Extract installer prerequisites. This overhauls duplicated, disorganized instructions. It begins by explaining the need to install Insiders, as installing production releases is a common mistake. It just says "and keep it up to date" without mentioning our exact required compiler version, as that doesn't affect what you select in the VS Installer. The version is now enforced by `CMakeLists.txt` with a clear message. It gives an explicit list of what workload and components to select. It doesn't bother with verbosely explaining that you can install CMake/Ninja independently. It lists AddressSanitizer, which we forgot earlier. It lists Clang immediately, instead of only mentioning it later in the testing sections. Also it doesn't bother with explaining that you can install Clang independently. It explains how to install Python with a little more detail. The duplication between the IDE and Command Prompt steps is now avoided, as the prereqs are exactly the same. Finally, the testing section can get straight to the point. --- README.md | 58 ++++++++++++++++++++++++------------------------------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 22776458934..d038daa3424 100644 --- a/README.md +++ b/README.md @@ -139,36 +139,37 @@ mention `std::` or C++. For example, "``: `is_cute` should be true It's okay if you report an apparent STL bug that turns out to be a compiler bug or surprising-yet-Standard behavior. Just try to follow these rules, so we can spend more time fixing bugs and implementing features. +# Visual Studio Installer Prerequisites + +1. Install [VS 2026 Insiders][] and keep it up to date. + + **You must install Insiders for STL development.** The STL and the compiler ship together, and we frequently + need the latest compiler fixes and features, so the last production release of the compiler is too old. +2. Select the "Desktop development with C++" workload. +3. Select the following components at a minimum: + + "MSVC v145 - C++ x64/x86 build tools (Latest)" + + "C++ CMake tools for Windows" + + "C++ AddressSanitizer" + + "Windows 11 SDK (10.0.26100)" or later + + "C++ Clang tools for Windows (20.1.8 - x64/x86)" + + *Optional:* "MSVC v145 - C++ ARM64/ARM64EC build tools (Latest)" +4. Install [Python][] 3.13 or later. + + Select "Add python.exe to PATH" if you want to follow the instructions below that invoke `python`. + Otherwise, you should be familiar with alternative methods. + # How To Build With The Visual Studio IDE -1. Install Visual Studio 2022 17.14.12 Preview 1 or later. - * Select "Windows 11 SDK (10.0.26100)" or later in the VS Installer. - * Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer - if you would like to build the ARM64/ARM64EC target. - * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. - This will ensure that you're using supported versions of CMake and Ninja. - * Otherwise, install [CMake][] 3.31.0 or later, and [Ninja][] 1.12.1 or later. - * Make sure [Python][] 3.13 or later is available to CMake. -2. Open Visual Studio, and choose the "Clone or check out code" option. Enter the URL of this repository, +1. Open Visual Studio, and choose the "Clone or check out code" option. Enter the URL of this repository, `https://github.com/microsoft/STL`. -3. Open a terminal in the IDE with `` Ctrl + ` `` (by default) or press on "View" in the top bar, and then "Terminal". -4. In the terminal, invoke `git submodule update --init --progress` -5. Choose the architecture you wish to build in the IDE, and build as you would any other project. All necessary CMake +2. Open a terminal in the IDE with `` Ctrl + ` `` (by default) or press on "View" in the top bar, and then "Terminal". +3. In the terminal, invoke `git submodule update --init --progress` +4. Choose the architecture you wish to build in the IDE, and build as you would any other project. All necessary CMake settings are set by `CMakePresets.json`. # How To Build With A Native Tools Command Prompt -1. Install Visual Studio 2022 17.14.12 Preview 1 or later. - * Select "Windows 11 SDK (10.0.26100)" or later in the VS Installer. - * Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer - if you would like to build the ARM64/ARM64EC target. - * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. - This will ensure that you're using supported versions of CMake and Ninja. - * Otherwise, install [CMake][] 3.31.0 or later, and [Ninja][] 1.12.1 or later. - * Make sure [Python][] 3.13 or later is available to CMake. -2. Open a command prompt. -3. Change directories to a location where you'd like a clone of this STL repository. -4. `git clone https://github.com/microsoft/STL.git --recurse-submodules` +1. Open a command prompt. +2. Change directories to a location where you'd like a clone of this STL repository. +3. `git clone https://github.com/microsoft/STL.git --recurse-submodules` To build the x64 target (recommended): @@ -249,16 +250,6 @@ C:\Users\username\Desktop>dumpbin /DEPENDENTS .\example.exe | findstr msvcp # How To Run The Tests With A Native Tools Command Prompt -1. Follow either [How To Build With A Native Tools Command Prompt][] or [How To Build With The Visual Studio IDE][]. -2. Acquire [Python][] 3.13 or newer and have it on the `PATH` (or run it directly using its absolute or relative path). -3. Have LLVM's `bin` directory on the `PATH` (so `clang-cl.exe` is available). - * We recommend selecting "C++ Clang tools for Windows" in the VS Installer. This will automatically add LLVM to the - `PATH` of the x64 and x86 Native Tools Command Prompts, and will ensure that you're using a supported version. - * Otherwise, use [LLVM's installer][] and choose to add LLVM to your `PATH` during installation. -4. Follow the instructions below. - -## Running The Tests - Our tests are currently split across three test suites that are located at `tests\std`, `tests\tr1`, and `llvm-project\libcxx\test\std`. The test runner `${PROJECT_BINARY_DIR}\tests\utils\stl-lit\stl-lit.py` accepts paths to directories in the test suites and runs all tests located in the subtree rooted at those paths. This can mean executing @@ -578,3 +569,4 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception [natvis documentation]: https://learn.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects [ASan]: https://learn.microsoft.com/en-us/cpp/sanitizers/asan [Import Library]: /docs/import_library.md +[VS 2026 Insiders]: https://visualstudio.microsoft.com/insiders/ From 4b48d1fab35fda2da3eacb69e067863e5eb780b7 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 07:15:18 -0700 Subject: [PATCH 10/62] README.md: Update vcvarsall.bat paths and command prompt names. Extract the "non-default location" explanation. Depict vcvarsall.bat for x64 and x86 (this is what I personally use in clean command prompts), with the shortcuts as alternatives. This also highlights the symmetry of the steps. --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d038daa3424..d1f38cb3b01 100644 --- a/README.md +++ b/README.md @@ -171,32 +171,34 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem 2. Change directories to a location where you'd like a clone of this STL repository. 3. `git clone https://github.com/microsoft/STL.git --recurse-submodules` +If you installed VS to a non-default location, change the `vcvarsall.bat` paths below accordingly. + To build the x64 target (recommended): -1. Open an "x64 Native Tools Command Prompt for VS 2022 Preview". +1. `"C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Auxiliary\Build\vcvarsall.bat" x64` + * Or open an "x64 Native Tools Command Prompt for VS 18 Insiders". 2. Change directories to the previously cloned `STL` directory. 3. `cmake --preset x64` 4. `cmake --build --preset x64` To build the x86 target: -1. Open an "x86 Native Tools Command Prompt for VS 2022 Preview". +1. `"C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Auxiliary\Build\vcvarsall.bat" x86` + * Or open an "x86 Native Tools Command Prompt for VS 18 Insiders". 2. Change directories to the previously cloned `STL` directory. 3. `cmake --preset x86` 4. `cmake --build --preset x86` To build the ARM64 target: -1. `"C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" x64_arm64` - * If you installed VS to a non-default location, change this path accordingly. +1. `"C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Auxiliary\Build\vcvarsall.bat" x64_arm64` 2. Change directories to the previously cloned `STL` directory. 3. `cmake --preset ARM64` 4. `cmake --build --preset ARM64` To build the ARM64EC target: -1. `"C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" x64_arm64` - * If you installed VS to a non-default location, change this path accordingly. +1. `"C:\Program Files\Microsoft Visual Studio\18\Insiders\VC\Auxiliary\Build\vcvarsall.bat" x64_arm64` 2. Change directories to the previously cloned `STL` directory. 3. `cmake --preset ARM64EC` 4. `cmake --build --preset ARM64EC` From ca48fead88e8b02b1b37bcdca742c094d7b6ddbc Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 07:17:52 -0700 Subject: [PATCH 11/62] README.md: Update the "complete example". Update the command prompt name. Make things clearer by showing the STL being built before it's used. Modernize the example to use std::println. --- README.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d1f38cb3b01..84d9cd126c8 100644 --- a/README.md +++ b/README.md @@ -228,25 +228,34 @@ variables to ensure that the built headers and libraries are used. ## Complete Example Using x64 DLL Flavor -From an "x64 Native Tools Command Prompt for VS 2022 Preview": +From an "x64 Native Tools Command Prompt for VS 18 Insiders": ``` -C:\Users\username\Desktop>C:\Dev\STL\out\x64\set_environment.bat +D:\GitHub\STL>cmake --preset x64 +[...] +-- Build files have been written to: D:/GitHub/STL/out/x64 -C:\Users\username\Desktop>type example.cpp -#include +D:\GitHub\STL>cmake --build --preset x64 +[1028/1028] Linking CXX static library out\lib\amd64\libcpmtd0.lib + +D:\GitHub\STL>out\x64\set_environment.bat + +D:\GitHub\STL>pushd C:\Temp + +C:\Temp>type .\example.cpp +#include int main() { - std::cout << "Hello STL OSS world!\n"; + std::println("Hello STL OSS world!"); } -C:\Users\username\Desktop>cl /nologo /EHsc /W4 /WX /MDd /std:c++latest .\example.cpp +C:\Temp>cl /EHsc /nologo /W4 /WX /MDd /std:c++latest .\example.cpp example.cpp -C:\Users\username\Desktop>.\example.exe +C:\Temp>.\example.exe Hello STL OSS world! -C:\Users\username\Desktop>dumpbin /DEPENDENTS .\example.exe | findstr msvcp +C:\Temp>dumpbin /DEPENDENTS .\example.exe | findstr msvcp msvcp140d_oss.dll ``` From 99a72188374e0b794df9ec60019ab67fa7988ce6 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 07:20:32 -0700 Subject: [PATCH 12/62] README.md: Remove unused links. --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 84d9cd126c8..b25e9786f15 100644 --- a/README.md +++ b/README.md @@ -544,22 +544,17 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception [Changelog]: https://github.com/microsoft/STL/wiki/Changelog [clang-format]: https://clang.llvm.org/docs/ClangFormat.html -[CMake]: https://cmake.org/download [CODE_OF_CONDUCT.md]: CODE_OF_CONDUCT.md [Compiler Explorer]: https://godbolt.org [CONTRIBUTING.md]: CONTRIBUTING.md [Developer Community]: https://aka.ms/feedback/report?space=62 [Discord server]: https://discord.gg/XWanNww -[How To Build With A Native Tools Command Prompt]: #how-to-build-with-a-native-tools-command-prompt -[How To Build With The Visual Studio IDE]: #how-to-build-with-the-visual-studio-ide [LICENSE.txt]: LICENSE.txt -[LLVM's installer]: https://releases.llvm.org/download.html [LWG issues]: https://cplusplus.github.io/LWG/lwg-toc.html [LWG tag]: https://github.com/microsoft/STL/issues?q=is%3Aopen+is%3Aissue+label%3ALWG [Microsoft Open Source Code of Conduct]: https://opensource.microsoft.com/codeofconduct/ [N5014]: https://wg21.link/N5014 [NOTICE.txt]: NOTICE.txt -[Ninja]: https://ninja-build.org [STL-CI-badge]: https://dev.azure.com/vclibs/STL/_apis/build/status%2FSTL-CI?branchName=main "STL-CI" [STL-CI-link]: https://dev.azure.com/vclibs/STL/_build/latest?definitionId=4&branchName=main [STL-ASan-CI-badge]: https://dev.azure.com/vclibs/STL/_apis/build/status%2FSTL-ASan-CI?branchName=main "STL-ASan-CI" From 651afe25e24c8187f9bc73c5212554b8d6efd9e2 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 08:17:12 -0700 Subject: [PATCH 13/62] Clang 20.1.8, now required. yvals_core.h: Just say "Clang 20" to avoid confusion. --- stl/inc/yvals_core.h | 4 ++-- tools/format/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 8289f0abe4b..3296b311b65 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -921,8 +921,8 @@ _EMIT_STL_ERROR(STL1002, "Unexpected compiler version, expected CUDA 12.4 or new #elif defined(__EDG__) // not attempting to detect __EDG_VERSION__ being less than expected #elif defined(__clang__) -#if __clang_major__ < 19 -_EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 19.0.0 or newer."); +#if __clang_major__ < 20 +_EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 20 or newer."); #endif // ^^^ old Clang ^^^ #elif defined(_MSC_VER) #if _MSC_VER < 1950 // Coarse-grained, not inspecting _MSC_FULL_VER diff --git a/tools/format/CMakeLists.txt b/tools/format/CMakeLists.txt index d0ecc26c9d0..252a05179bf 100644 --- a/tools/format/CMakeLists.txt +++ b/tools/format/CMakeLists.txt @@ -18,7 +18,7 @@ execute_process( ) if(clang_format_version MATCHES "clang-format version ([0-9]+\.[0-9]+\.[0-9]+)") - set(expected_version "19.1.5") + set(expected_version "20.1.8") if(CMAKE_MATCH_1 VERSION_LESS expected_version) message(FATAL_ERROR "Found clang-format: ${CLANG_FORMAT} (\"${CMAKE_MATCH_1}\", older than expected version \"${expected_version}\")") elseif(CMAKE_MATCH_1 VERSION_EQUAL expected_version) From 612d9001c139551bb47953897ac7d4af0605694d Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 09:15:37 -0700 Subject: [PATCH 14/62] bug-report.md: Update options for reporting the STL version. Help > About isn't useful anymore, so let's recommend the `cl.exe` version or `_MSVC_STL_UPDATE` value instead. Finally, expand the example commit hash to full. --- .github/ISSUE_TEMPLATE/bug-report.md | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index a7c96480391..97b57aaa2dd 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -53,17 +53,32 @@ Alternatively, include `static_assert` or `assert` lines in your test case above whose failure clearly indicates the problem. # STL version -* Option 1: Visual Studio version - + Help > About Microsoft Visual Studio > Copy Info, we need only the first two lines +* Option 1: MSVC Compiler version + Example: ``` - Microsoft Visual Studio Community 2022 - Version 17.6.0 Preview 3.0 + C:\Temp>cl.exe + Microsoft (R) C/C++ Optimizing Compiler Version 19.50.35503 for x64 + Copyright (C) Microsoft Corporation. All rights reserved. + + usage: cl [ option... ] filename... [ /link linkoption... ] + ``` +* Option 2: `_MSVC_STL_UPDATE` value + + Example: + ``` + C:\Temp>type meow.cpp + #include + int main() { + std::cout << _MSVC_STL_UPDATE << "\n"; + } + + C:\Temp>cl /EHsc /nologo /W4 meow.cpp && meow + meow.cpp + 202507 ``` -* Option 2: git commit hash +* Option 3: git commit hash + Example: ``` - https://github.com/microsoft/STL/commit/2195148 + https://github.com/microsoft/STL/commit/219514876ea86491de191ceaa88632616bbc0f19 ``` # Additional context From 5349c4aafc9aa2af4a44f8401438d4403a06f46c Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 09:26:49 -0700 Subject: [PATCH 15/62] azure-devops/config.yml: Centralize VsDevCmd.bat path. --- azure-devops/build-benchmarks.yml | 4 ++-- azure-devops/cmake-configure-build.yml | 4 ++-- azure-devops/config.yml | 3 +++ azure-devops/format-validation.yml | 6 +++--- azure-devops/run-tests.yml | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/azure-devops/build-benchmarks.yml b/azure-devops/build-benchmarks.yml index 05165b52d7d..b19563ee935 100644 --- a/azure-devops/build-benchmarks.yml +++ b/azure-devops/build-benchmarks.yml @@ -18,7 +18,7 @@ steps: if exist "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" ( rmdir /S /Q "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" ) - call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ + call "$(vsDevCmdBat)" ^ -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo cmake -G Ninja ^ -DCMAKE_CXX_COMPILER=${{ parameters.compiler }} ^ @@ -35,7 +35,7 @@ steps: not(and(eq('${{ parameters.compiler }}', 'clang-cl'), not(eq('${{ parameters.targetPlatform }}', 'x64'))))) - script: | - call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ + call "$(vsDevCmdBat)" ^ -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo cmake --build "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" displayName: 'Build the benchmarks for ${{ parameters.compiler }}' diff --git a/azure-devops/cmake-configure-build.yml b/azure-devops/cmake-configure-build.yml index c8db703e61c..48651817939 100644 --- a/azure-devops/cmake-configure-build.yml +++ b/azure-devops/cmake-configure-build.yml @@ -27,7 +27,7 @@ steps: if exist "$(buildOutputLocation)" ( rmdir /S /Q "$(buildOutputLocation)" ) - call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ + call "$(vsDevCmdBat)" ^ -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo cmake -G Ninja ^ -DCMAKE_CXX_COMPILER=cl ^ @@ -42,7 +42,7 @@ steps: timeoutInMinutes: 2 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - script: | - call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ + call "$(vsDevCmdBat)" ^ -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo cmake --build "$(buildOutputLocation)" displayName: 'Build the STL' diff --git a/azure-devops/config.yml b/azure-devops/config.yml index 73a85b5230d..934502132fc 100644 --- a/azure-devops/config.yml +++ b/azure-devops/config.yml @@ -10,6 +10,9 @@ variables: - name: poolDemands value: 'EnableSpotVM -equals false' readonly: true +- name: vsDevCmdBat + value: '%ProgramFiles%\Microsoft Visual Studio\18\Insiders\Common7\Tools\VsDevCmd.bat' + readonly: true - name: tmpDir value: 'C:\stlTemp' readonly: true diff --git a/azure-devops/format-validation.yml b/azure-devops/format-validation.yml index 945c96d1b0b..086ea8b5046 100644 --- a/azure-devops/format-validation.yml +++ b/azure-devops/format-validation.yml @@ -13,7 +13,7 @@ jobs: if exist "$(validationBuildOutputLocation)" ( rmdir /S /Q "$(validationBuildOutputLocation)" ) - call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ + call "$(vsDevCmdBat)" ^ -host_arch=x64 -arch=x64 -no_logo cmake -G Ninja -S $(Build.SourcesDirectory)/tools -B "$(validationBuildOutputLocation)" cmake --build "$(validationBuildOutputLocation)" @@ -21,14 +21,14 @@ jobs: timeoutInMinutes: 5 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - script: | - call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ + call "$(vsDevCmdBat)" ^ -host_arch=x64 -arch=x64 -no_logo cmake --build "$(validationBuildOutputLocation)" --target run-format displayName: 'clang-format Files' timeoutInMinutes: 5 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - script: | - call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ + call "$(vsDevCmdBat)" ^ -host_arch=x64 -arch=x64 -no_logo cmake --build "$(validationBuildOutputLocation)" --target run-validate displayName: 'Validate Files' diff --git a/azure-devops/run-tests.yml b/azure-devops/run-tests.yml index aba67bc3e87..2e4c33a1c8a 100644 --- a/azure-devops/run-tests.yml +++ b/azure-devops/run-tests.yml @@ -14,7 +14,7 @@ parameters: type: boolean steps: - script: | - call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ + call "$(vsDevCmdBat)" ^ -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo ninja --verbose -k 0 ${{ parameters.testTargets }} displayName: 'Build and Run Tests' From 915acfe1dcacc3606c56783a124f3f7c4fe0582e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 09:31:05 -0700 Subject: [PATCH 16/62] Unwrap vsDevCmdBat calls. --- azure-devops/build-benchmarks.yml | 6 ++---- azure-devops/cmake-configure-build.yml | 6 ++---- azure-devops/format-validation.yml | 9 +++------ azure-devops/run-tests.yml | 3 +-- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/azure-devops/build-benchmarks.yml b/azure-devops/build-benchmarks.yml index b19563ee935..39bc4a3e325 100644 --- a/azure-devops/build-benchmarks.yml +++ b/azure-devops/build-benchmarks.yml @@ -18,8 +18,7 @@ steps: if exist "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" ( rmdir /S /Q "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" ) - call "$(vsDevCmdBat)" ^ - -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo + call "$(vsDevCmdBat)" -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo cmake -G Ninja ^ -DCMAKE_CXX_COMPILER=${{ parameters.compiler }} ^ -DCMAKE_BUILD_TYPE=Release ^ @@ -35,8 +34,7 @@ steps: not(and(eq('${{ parameters.compiler }}', 'clang-cl'), not(eq('${{ parameters.targetPlatform }}', 'x64'))))) - script: | - call "$(vsDevCmdBat)" ^ - -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo + call "$(vsDevCmdBat)" -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo cmake --build "$(benchmarkBuildOutputLocation)\${{ parameters.compiler }}" displayName: 'Build the benchmarks for ${{ parameters.compiler }}' timeoutInMinutes: 2 diff --git a/azure-devops/cmake-configure-build.yml b/azure-devops/cmake-configure-build.yml index 48651817939..d60b672bd3a 100644 --- a/azure-devops/cmake-configure-build.yml +++ b/azure-devops/cmake-configure-build.yml @@ -27,8 +27,7 @@ steps: if exist "$(buildOutputLocation)" ( rmdir /S /Q "$(buildOutputLocation)" ) - call "$(vsDevCmdBat)" ^ - -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo + call "$(vsDevCmdBat)" -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo cmake -G Ninja ^ -DCMAKE_CXX_COMPILER=cl ^ -DCMAKE_BUILD_TYPE=Release ^ @@ -42,8 +41,7 @@ steps: timeoutInMinutes: 2 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - script: | - call "$(vsDevCmdBat)" ^ - -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo + call "$(vsDevCmdBat)" -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo cmake --build "$(buildOutputLocation)" displayName: 'Build the STL' timeoutInMinutes: 5 diff --git a/azure-devops/format-validation.yml b/azure-devops/format-validation.yml index 086ea8b5046..b9345716379 100644 --- a/azure-devops/format-validation.yml +++ b/azure-devops/format-validation.yml @@ -13,23 +13,20 @@ jobs: if exist "$(validationBuildOutputLocation)" ( rmdir /S /Q "$(validationBuildOutputLocation)" ) - call "$(vsDevCmdBat)" ^ - -host_arch=x64 -arch=x64 -no_logo + call "$(vsDevCmdBat)" -host_arch=x64 -arch=x64 -no_logo cmake -G Ninja -S $(Build.SourcesDirectory)/tools -B "$(validationBuildOutputLocation)" cmake --build "$(validationBuildOutputLocation)" displayName: 'Build format and validation' timeoutInMinutes: 5 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - script: | - call "$(vsDevCmdBat)" ^ - -host_arch=x64 -arch=x64 -no_logo + call "$(vsDevCmdBat)" -host_arch=x64 -arch=x64 -no_logo cmake --build "$(validationBuildOutputLocation)" --target run-format displayName: 'clang-format Files' timeoutInMinutes: 5 env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - script: | - call "$(vsDevCmdBat)" ^ - -host_arch=x64 -arch=x64 -no_logo + call "$(vsDevCmdBat)" -host_arch=x64 -arch=x64 -no_logo cmake --build "$(validationBuildOutputLocation)" --target run-validate displayName: 'Validate Files' timeoutInMinutes: 2 diff --git a/azure-devops/run-tests.yml b/azure-devops/run-tests.yml index 2e4c33a1c8a..22357e528fe 100644 --- a/azure-devops/run-tests.yml +++ b/azure-devops/run-tests.yml @@ -14,8 +14,7 @@ parameters: type: boolean steps: - script: | - call "$(vsDevCmdBat)" ^ - -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo + call "$(vsDevCmdBat)" -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo ninja --verbose -k 0 ${{ parameters.testTargets }} displayName: 'Build and Run Tests' timeoutInMinutes: 30 From 1157dce241a53c51003e16c9ed0972b5cd63b4ef Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 09:43:18 -0700 Subject: [PATCH 17/62] Remove suppressions of warning C4127 "conditional expression is constant", removed by MSVC-PR-646313 on 2025-06-25. --- stl/inc/span | 3 --- tests/std/tests/P2321R2_views_zip/test.cpp | 3 --- tests/std/tests/P2321R2_views_zip_transform/test.cpp | 3 --- 3 files changed, 9 deletions(-) diff --git a/stl/inc/span b/stl/inc/span index ec504c98775..e1f58060c8a 100644 --- a/stl/inc/span +++ b/stl/inc/span @@ -465,8 +465,6 @@ public: return _Mydata[_Off]; } -#pragma warning(push) -#pragma warning(disable : 4127) // conditional expression is constant _NODISCARD constexpr reference front() const noexcept /* strengthened */ { #if _MSVC_STL_HARDENING_SPAN || _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Mysize > 0, "front() called on empty span"); @@ -482,7 +480,6 @@ public: return _Mydata[_Mysize - 1]; } -#pragma warning(pop) _NODISCARD constexpr pointer data() const noexcept { return _Mydata; diff --git a/tests/std/tests/P2321R2_views_zip/test.cpp b/tests/std/tests/P2321R2_views_zip/test.cpp index 5f370874c83..c38d0251d09 100644 --- a/tests/std/tests/P2321R2_views_zip/test.cpp +++ b/tests/std/tests/P2321R2_views_zip/test.cpp @@ -356,12 +356,9 @@ constexpr bool test_one(TestContainerType& test_container, RangeTypes&&... rngs) return do_tuples_reference_same_objects(lhs_tuple, rhs_tuple); })); -#pragma warning(push) -#pragma warning(disable : 4127) // Conditional Expression is Constant if (!(ranges::forward_range> && ...)) { // intentionally not if constexpr return true; } -#pragma warning(pop) // Validate view_interface::data() // diff --git a/tests/std/tests/P2321R2_views_zip_transform/test.cpp b/tests/std/tests/P2321R2_views_zip_transform/test.cpp index dd08fcb1b90..e29f45c3078 100644 --- a/tests/std/tests/P2321R2_views_zip_transform/test.cpp +++ b/tests/std/tests/P2321R2_views_zip_transform/test.cpp @@ -498,13 +498,10 @@ constexpr bool test_one(TransformType_&& transformer, const TransformedElementsC // Validate contents of zip-transformed range assert(ranges::equal(zipped_transformed_range, transformed_elements)); -#pragma warning(push) -#pragma warning(disable : 4127) // Conditional Expression is Constant if (!(ranges::forward_range> && ...)) // intentionally not if constexpr { return true; } -#pragma warning(pop) // Validate view_interface::data() // From ac706412dc5543c25aa1bbd856f32cde4a2027d9 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 09:57:38 -0700 Subject: [PATCH 18/62] C4127 followup: Fuse constexpr bools where the names provided minimal value. --- stl/inc/bitset | 3 +-- stl/inc/codecvt | 21 +++++++++------------ stl/inc/random | 3 +-- stl/inc/xmemory | 3 +-- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/stl/inc/bitset b/stl/inc/bitset index 30148f6579f..372f8784018 100644 --- a/stl/inc/bitset +++ b/stl/inc/bitset @@ -483,8 +483,7 @@ public: } _NODISCARD _CONSTEXPR23 bool all() const noexcept { - constexpr bool _Zero_length = _Bits == 0; - if constexpr (_Zero_length) { // must test for this, otherwise would count one full word + if constexpr (_Bits == 0) { // must test for this, otherwise would count one full word return true; } diff --git a/stl/inc/codecvt b/stl/inc/codecvt index ccf3075d577..c46df0d3f8c 100644 --- a/stl/inc/codecvt +++ b/stl/inc/codecvt @@ -95,8 +95,7 @@ protected: if (*_Pstate == 0) { // first time, maybe look for and consume header *_Pstate = 1; - constexpr bool _Consuming = (_Mymode & consume_header) != 0; - if constexpr (_Consuming) { + if constexpr ((_Mymode & consume_header) != 0) { if (_Ch == 0xfeff) { // drop header and retry const result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); @@ -157,9 +156,9 @@ protected: } if (*_Pstate == 0) { // first time, maybe generate header - *_Pstate = 1; - constexpr bool _Generating = (_Mymode & generate_header) != 0; - if constexpr (_Generating) { + *_Pstate = 1; + + if constexpr ((_Mymode & generate_header) != 0) { if (_Last2 - _Mid2 < 3 + 1 + _Nextra) { return _Mybase::partial; // not enough room for both } @@ -267,9 +266,9 @@ protected: _Ch0 = static_cast(_Ptr[0] << 8 | _Ptr[1]); } - *_Pstate = _Default_endian; - constexpr bool _Consuming = (_Mymode & consume_header) != 0; - if constexpr (_Consuming) { + *_Pstate = _Default_endian; + + if constexpr ((_Mymode & consume_header) != 0) { if (_Ch0 == 0xfffeu) { *_Pstate = 3 - _Default_endian; } @@ -332,8 +331,7 @@ protected: *_Pstate = _Big_first; } - constexpr bool _Generating = (_Mymode & generate_header) != 0; - if constexpr (_Generating) { + if constexpr ((_Mymode & generate_header) != 0) { if (_Last2 - _Mid2 < 3 * _Bytes_per_word) { return _Mybase::partial; // not enough room for all } @@ -550,8 +548,7 @@ protected: if (*_Pstate == 0u) { // first time, maybe look for and consume header *_Pstate = 1; - constexpr bool _Consuming = (_Mymode & consume_header) != 0; - if constexpr (_Consuming) { + if constexpr ((_Mymode & consume_header) != 0) { if (_Ch == 0xfeffu) { // drop header and retry result _Ans = do_in(_State, _Mid1, _Last1, _Mid1, _First2, _Last2, _Mid2); diff --git a/stl/inc/random b/stl/inc/random index 37150284a91..eb8934ba224 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -1104,8 +1104,7 @@ public: this->_Ax[_Ix] |= static_cast<_Ty>(_Arr[_Idx0 + _Jx]) << (32 * _Jx); } - constexpr bool _Mod_non_zero = _Traits::_Mod != 0; - if constexpr (_Mod_non_zero) { + if constexpr (_Traits::_Mod != 0) { this->_Ax[_Ix] %= _Traits::_Mod; } } diff --git a/stl/inc/xmemory b/stl/inc/xmemory index e4cfa3008b5..e1591da1b22 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -2770,8 +2770,7 @@ _NODISCARD _Elem* _UIntegral_to_buff(_Elem* _RNext, _UTy _UVal) { // used by bot auto _UVal_trunc = _UVal; #else // ^^^ defined(_WIN64) / !defined(_WIN64) vvv - constexpr bool _Big_uty = sizeof(_UTy) > 4; - if constexpr (_Big_uty) { // For 64-bit numbers, work in chunks to avoid 64-bit divisions. + if constexpr (sizeof(_UTy) > 4) { // For 64-bit numbers, work in chunks to avoid 64-bit divisions. while (_UVal > 0xFFFFFFFFU) { auto _UVal_chunk = static_cast(_UVal % 1000000000); _UVal /= 1000000000; From b36ffcfea68cd1bf62184774580ab2b18f4c3a9f Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 10:01:26 -0700 Subject: [PATCH 19/62] Remove workaround for DevCom-10291456 / VSO-1754445, which had been fixed by 2024-05-21. --- stl/inc/memory | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stl/inc/memory b/stl/inc/memory index 1d1cf71b420..52eded06dcf 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -4377,8 +4377,7 @@ public: noexcept(is_nothrow_constructible_v, _ArgsT...>) /* strengthened */ : _Smart_ptr(_Smart_ptr_), _Mypair(_One_then_variadic_args_t{}, tuple<_ArgsT...>{_STD forward<_ArgsT>(_Args_)...}) { - constexpr bool _Is_resettable = requires { _Smart_ptr.reset(); }; // TRANSITION, DevCom-10291456 - if constexpr (_Is_resettable) { + if constexpr (requires { _Smart_ptr.reset(); }) { _Smart_ptr.reset(); } else { static_assert(is_constructible_v<_SmartPtr>, "the adapted pointer type must be default constructible."); From 082d646618b821a4bdeeb04ef5c07f988fee8a45 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 10:08:21 -0700 Subject: [PATCH 20/62] Remove workarounds for VSO-1513409, fixed by MSVC-PR-647159 on 2025-06-27. --- stl/inc/variant | 3 --- tests/libcxx/expected_results.txt | 4 ---- 2 files changed, 7 deletions(-) diff --git a/stl/inc/variant b/stl/inc/variant index c17d88fe17e..8b6c7390aa9 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -1415,9 +1415,6 @@ struct _Variant_dispatcher> { template _NODISCARD static constexpr _Ret _Dispatch2(_Callable&& _Obj, _Types&&... _Args) { if constexpr (_Any_valueless) { -#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, VSO-1513409 - ((void) _Args, ...); -#endif // ^^^ workaround ^^^ _STD _Throw_bad_variant_access(); } #if _HAS_CXX20 diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 159635d7bb8..4531ab22fdd 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -640,10 +640,6 @@ std/language.support/cmp/cmp.concept/three_way_comparable_with.compile.pass.cpp: std/language.support/cmp/cmp.result/compare_three_way_result.compile.pass.cpp:0 FAIL std/language.support/cmp/cmp.result/compare_three_way_result.compile.pass.cpp:1 FAIL -# VSO-1513409: Bogus `warning C4100: '<_Args_0>': unreferenced formal parameter` when `if constexpr` selects another branch -std/containers/views/mdspan/mdspan/ctor.dh_integers.pass.cpp:0 FAIL -std/containers/views/mdspan/mdspan/ctor.dh_integers.pass.cpp:1 FAIL - # DevCom-10026599 VSO-1532879: conditional expression has two different types std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp:0 FAIL std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp:1 FAIL From 0eb25e12af04cae80ebd1e6bad25a24289745ccb Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 10:38:31 -0700 Subject: [PATCH 21/62] Remove workaround for GH 5506 / DevCom-10906320 / VSO-2495607, fixed by MSVC-PR-643622 on 2025-06-30. --- stl/src/vector_algorithms.cpp | 47 ++--------------------------------- 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/stl/src/vector_algorithms.cpp b/stl/src/vector_algorithms.cpp index 475900b762d..67d008a1c99 100644 --- a/stl/src/vector_algorithms.cpp +++ b/stl/src/vector_algorithms.cpp @@ -252,49 +252,6 @@ namespace { } } - - // TRANSITION, GH-5506 "VCRuntime: memmove() is surprisingly slow for more than 8 KB on certain CPUs": - // As a workaround, the following code calls memmove() for 8 KB portions. - constexpr size_t _Portion_size = 8192; - constexpr size_t _Portion_mask = _Portion_size - 1; - static_assert((_Portion_size & _Portion_mask) == 0); - - void _Move_to_lower_address(void* _Dest, const void* _Src, const size_t _Size) noexcept { - const size_t _Whole_portions_size = _Size & ~_Portion_mask; - - void* _Dest_end = _Dest; - _Advance_bytes(_Dest_end, _Whole_portions_size); - - while (_Dest != _Dest_end) { - memmove(_Dest, _Src, _Portion_size); - _Advance_bytes(_Dest, _Portion_size); - _Advance_bytes(_Src, _Portion_size); - } - - if (const size_t _Tail = _Size - _Whole_portions_size; _Tail != 0) { - memmove(_Dest, _Src, _Tail); - } - } - - void _Move_to_higher_address(void* const _Dest, const void* const _Src, const size_t _Size) noexcept { - const size_t _Whole_portions_size = _Size & ~_Portion_mask; - - void* _Dest_end = _Dest; - _Advance_bytes(_Dest_end, _Whole_portions_size); - const void* _Src_end = _Src; - _Advance_bytes(_Src_end, _Whole_portions_size); - - if (const size_t _Tail = _Size - _Whole_portions_size; _Tail != 0) { - memmove(_Dest_end, _Src_end, _Tail); - } - - while (_Dest_end != _Dest) { - _Rewind_bytes(_Dest_end, _Portion_size); - _Rewind_bytes(_Src_end, _Portion_size); - memmove(_Dest_end, _Src_end, _Portion_size); - } - } - constexpr size_t _Buf_size = 512; bool _Use_buffer(const size_t _Smaller, const size_t _Larger) noexcept { @@ -319,7 +276,7 @@ __declspec(noalias) void __stdcall __std_rotate(void* _First, void* const _Mid, if (_Rotating::_Use_buffer(_Left, _Right)) { memcpy(_Buf, _First, _Left); - _Rotating::_Move_to_lower_address(_First, _Mid, _Right); + memmove(_First, _Mid, _Right); _Advance_bytes(_First, _Right); memcpy(_First, _Buf, _Left); break; @@ -346,7 +303,7 @@ __declspec(noalias) void __stdcall __std_rotate(void* _First, void* const _Mid, memcpy(_Buf, _Last, _Right); void* _Mid2 = _First; _Advance_bytes(_Mid2, _Right); - _Rotating::_Move_to_higher_address(_Mid2, _First, _Left); + memmove(_Mid2, _First, _Left); memcpy(_First, _Buf, _Right); break; } From 6751e355fcbdb3c5fde7d94fec84d1892d711a80 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 10:44:20 -0700 Subject: [PATCH 22/62] Remove workaround for VSO-1956558, fixed by VS-PR-656849 on 2025-07-29. --- stl/inc/__msvc_ranges_tuple_formatter.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stl/inc/__msvc_ranges_tuple_formatter.hpp b/stl/inc/__msvc_ranges_tuple_formatter.hpp index 176bf1eb762..e83f849b50e 100644 --- a/stl/inc/__msvc_ranges_tuple_formatter.hpp +++ b/stl/inc/__msvc_ranges_tuple_formatter.hpp @@ -265,8 +265,7 @@ class basic_format_arg { } }; -#if defined(__clang__) || defined(__EDG__) \ - || defined(__CUDACC__) // TRANSITION, LLVM-81774 (Clang), VSO-1956558 (EDG), VSO-2411436 (needed by CUDA 12.8.1) +#if defined(__clang__) || defined(__CUDACC__) // TRANSITION, LLVM-81774 (Clang), VSO-2411436 (needed by CUDA 12.8.1) basic_format_arg() noexcept : _Active_state(_Basic_format_arg_type::_None), _No_state() {} #else // ^^^ workaround / no workaround vvv basic_format_arg() noexcept = default; From 6e05ba8487b79007151f39e8a00c65d0ffb70429 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 10:48:02 -0700 Subject: [PATCH 23/62] Remove workaround for VSO-1588614, no longer repros as of 2025-06-10. --- tests/std/tests/P1206R7_ranges_to_misc/test.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/std/tests/P1206R7_ranges_to_misc/test.cpp b/tests/std/tests/P1206R7_ranges_to_misc/test.cpp index 065b8a5dd82..f168fd834be 100644 --- a/tests/std/tests/P1206R7_ranges_to_misc/test.cpp +++ b/tests/std/tests/P1206R7_ranges_to_misc/test.cpp @@ -368,9 +368,7 @@ int main() { static_assert(test_common_constructible()); test_nested_range(); -#if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1588614 static_assert(test_nested_range()); -#endif // ^^^ no workaround ^^^ test_lwg3733(); static_assert(test_lwg3733()); From 8d4250b43af8c8cc819968a637f8b5364238ed42 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 10:49:24 -0700 Subject: [PATCH 24/62] Remove workaround for VSO-1923988, no longer repros as of 2025-06-10. copy_backward.pass.cpp and copy.pass.cpp are still failing due to truncation warnings. --- tests/libcxx/expected_results.txt | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 4531ab22fdd..07fa9b5e596 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -652,18 +652,6 @@ std/containers/sequences/array/array.cons/initialization.pass.cpp:1 FAIL std/algorithms/robust_against_adl.compile.pass.cpp:0 FAIL std/algorithms/robust_against_adl.compile.pass.cpp:1 FAIL -# VSO-1923988: constexpr evaluation performs an assignment with a derived type when it should use a base type -std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp:0 FAIL -std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp:1 FAIL -std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp:0 FAIL -std/algorithms/alg.modifying.operations/alg.copy/copy_n.pass.cpp:1 FAIL -std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp:0 FAIL -std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp:1 FAIL -std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp:0 FAIL -std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp:1 FAIL -std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp:0 FAIL -std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp:1 FAIL - # VSO-1948221 x86chk ICE with constexpr type_info: Assertion failed: isIndirection() std/language.support/support.rtti/type.info/type_info.equal.pass.cpp:0 FAIL std/language.support/support.rtti/type.info/type_info.equal.pass.cpp:1 FAIL @@ -1543,6 +1531,12 @@ std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp # Clang asserts `allocated_ == 0 || allocated_ >= i` due to the container proxy object. std/strings/basic.string/string.capacity/deallocate_size.pass.cpp FAIL +# Not analyzed. MSVC emits warning C4267: 'argument': conversion from 'size_t' to 'unsigned char', possible loss of data +std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp:0 FAIL +std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp:1 FAIL +std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp:0 FAIL +std/algorithms/alg.modifying.operations/alg.copy/copy.pass.cpp:1 FAIL + # *** XFAILS WHICH PASS *** # These tests contain `// XFAIL: msvc` comments, which accurately describe runtime failures for x86 and x64. From 704505daa87ef5dc8b0cf703ce08643282e2bfa5 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 10:50:43 -0700 Subject: [PATCH 25/62] Remove workaround for VSO-934264, no longer repros as of 2025-06-10. --- tests/std/tests/P0896R4_views_join/test.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/std/tests/P0896R4_views_join/test.cpp b/tests/std/tests/P0896R4_views_join/test.cpp index 2e14c108161..ce0eedeec01 100644 --- a/tests/std/tests/P0896R4_views_join/test.cpp +++ b/tests/std/tests/P0896R4_views_join/test.cpp @@ -743,9 +743,7 @@ int main() { // Validate non-views { // ... C array static constexpr int join_me[5][2] = {{0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}}; -#if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-934264 static_assert(test_one(join_me, expected_ints)); -#endif // ^^^ no workaround ^^^ test_one(join_me, expected_ints); } { // ... fwd container From c5ef6a0c28d8e127cd3226347240effea61458c5 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 13:00:02 -0700 Subject: [PATCH 26/62] Remove workarounds for DevCom-1638496 VSO-1462745, which was fixed by MSVC-PR-643706 on 2025-06-16. --- tests/libcxx/expected_results.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 07fa9b5e596..879d7003121 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -634,12 +634,6 @@ std/algorithms/robust_re_difference_type.compile.pass.cpp:1 FAIL # Note: The :1 (ASan) configuration doesn't run static analysis. std/language.support/support.coroutines/end.to.end/go.pass.cpp:0 FAIL -# DevCom-1638496 VSO-1462745: C1XX doesn't properly reject int <=> unsigned -std/language.support/cmp/cmp.concept/three_way_comparable_with.compile.pass.cpp:0 FAIL -std/language.support/cmp/cmp.concept/three_way_comparable_with.compile.pass.cpp:1 FAIL -std/language.support/cmp/cmp.result/compare_three_way_result.compile.pass.cpp:0 FAIL -std/language.support/cmp/cmp.result/compare_three_way_result.compile.pass.cpp:1 FAIL - # DevCom-10026599 VSO-1532879: conditional expression has two different types std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp:0 FAIL std/concepts/concepts.compare/concept.equalitycomparable/equality_comparable_with.compile.pass.cpp:1 FAIL From 80da353a185264af08e13951cc284ad907ddbdb4 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 13:00:29 -0700 Subject: [PATCH 27/62] Remove workarounds for many unreported constexpr bugs. --- tests/libcxx/expected_results.txt | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 879d7003121..7b6e9bfbbd6 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -1268,24 +1268,6 @@ std/time/time.syn/formatter.tai_time.pass.cpp:2 FAIL std/time/time.syn/formatter.utc_time.pass.cpp:2 FAIL std/time/time.syn/formatter.zoned_time.pass.cpp:2 FAIL -# Not analyzed. constexpr evaluation fails with note: failure was caused by out of range index MEOW; allowed range is 0 <= index < 2 -std/ranges/range.adaptors/range.join/adaptor.pass.cpp:0 FAIL -std/ranges/range.adaptors/range.join/adaptor.pass.cpp:1 FAIL -std/ranges/range.adaptors/range.join/range.join.iterator/increment.pass.cpp:0 FAIL -std/ranges/range.adaptors/range.join/range.join.iterator/increment.pass.cpp:1 FAIL - -# Not analyzed. constexpr evaluation fails in assert(*--iter == i). -std/ranges/range.adaptors/range.join/range.join.iterator/decrement.pass.cpp:0 FAIL -std/ranges/range.adaptors/range.join/range.join.iterator/decrement.pass.cpp:1 FAIL - -# Not analyzed. constexpr evaluation fails in assert(*iter++ == i). -std/ranges/range.adaptors/range.join/range.join.iterator/star.pass.cpp:0 FAIL -std/ranges/range.adaptors/range.join/range.join.iterator/star.pass.cpp:1 FAIL - -# Not analyzed. constexpr evaluation fails in ranges::swap. -std/ranges/range.adaptors/range.join/range.join.iterator/iter.swap.pass.cpp:0 FAIL -std/ranges/range.adaptors/range.join/range.join.iterator/iter.swap.pass.cpp:1 FAIL - # Not analyzed. Likely MSVC constexpr bug, "note: failure was caused by a read of a variable outside its lifetime" std/containers/views/mdspan/mdspan/index_operator.pass.cpp:0 FAIL std/containers/views/mdspan/mdspan/index_operator.pass.cpp:1 FAIL @@ -1302,10 +1284,6 @@ std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_delet std/ranges/range.adaptors/range.join.with/range.join.with.iterator/ctor.not_const.pass.cpp:0 FAIL std/ranges/range.adaptors/range.join.with/range.join.with.iterator/ctor.not_const.pass.cpp:1 FAIL -# Not analyzed. Likely MSVC constexpr bug, "note: a non-constant (sub-)expression was encountered" in swap() -std/utilities/utility/utility.swap/swap_array.pass.cpp:0 FAIL -std/utilities/utility/utility.swap/swap_array.pass.cpp:1 FAIL - # Not analyzed. MSVC constexpr ICE. std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp:0 FAIL std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp:1 FAIL From f6f60bb3582d099bd20fc47e9060674ce060df59 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 22:28:53 -0700 Subject: [PATCH 28/62] Comment LLVM-62096 as fixed in Clang 21. Verified: https://godbolt.org/z/7zEWYYjP9 --- tests/std/tests/P2278R4_views_as_const/test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/std/tests/P2278R4_views_as_const/test.cpp b/tests/std/tests/P2278R4_views_as_const/test.cpp index 5bc64dd26cc..6b1e68830a5 100644 --- a/tests/std/tests/P2278R4_views_as_const/test.cpp +++ b/tests/std/tests/P2278R4_views_as_const/test.cpp @@ -628,7 +628,7 @@ using move_only_view = test::range; int main() { -#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, LLVM-62096 and VSO-1901430 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, LLVM-62096 (fixed in Clang 21) and VSO-1901430 { // Validate views // ... copyable constexpr span s{some_ints}; @@ -694,7 +694,7 @@ int main() { test_one(as_const(views::empty), empty_arr); } -#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, LLVM-62096 and VSO-1901430 +#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, LLVM-62096 (fixed in Clang 21) and VSO-1901430 { // empty range using Span = span; static_assert(test_one(Span{}, Span{})); From fbd0f9f0ececdbc8cb5b6ea9023bf2d490487f92 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 12 Sep 2025 07:28:39 -0700 Subject: [PATCH 29/62] Report and add workarounds for regression LLVM-158302. --- tests/libcxx/expected_results.txt | 6 ++++++ tests/std/tests/VSO_0095837_current_exception_dtor/test.cpp | 2 ++ .../VSO_0104705_throwing_copy_in_current_exception/test.cpp | 2 ++ 3 files changed, 10 insertions(+) diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 7b6e9bfbbd6..a8a88bfa749 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -51,6 +51,12 @@ std/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cp std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp:0 FAIL std/strings/basic.string/string.modifiers/string_assign/string.pass.cpp:1 FAIL +# LLVM-158302: Clang 20 i686-pc-windows-msvc regression, silent bad codegen for std::current_exception() +# SKIPPED because this is x86-specific. +std/language.support/support.exception/except.nested/assign.pass.cpp:2 SKIPPED +std/language.support/support.exception/except.nested/ctor_copy.pass.cpp:2 SKIPPED +std/language.support/support.exception/except.nested/ctor_default.pass.cpp:2 SKIPPED + # Non-Standard regex behavior. # "It seems likely that the test is still non-conforming due to how libc++ handles the 'w' character class." std/re/re.traits/lookup_classname.pass.cpp FAIL diff --git a/tests/std/tests/VSO_0095837_current_exception_dtor/test.cpp b/tests/std/tests/VSO_0095837_current_exception_dtor/test.cpp index c5db4e949a0..f61b08db6c0 100644 --- a/tests/std/tests/VSO_0095837_current_exception_dtor/test.cpp +++ b/tests/std/tests/VSO_0095837_current_exception_dtor/test.cpp @@ -75,10 +75,12 @@ void meow() { } int main() { +#if !(defined(__clang__) && defined(_M_IX86)) // TRANSITION, LLVM-158302 try { meow(); } catch (...) { assert(uncaught_exceptions() == 0); assert(current_exception()); } +#endif // ^^^ no workaround ^^^ } diff --git a/tests/std/tests/VSO_0104705_throwing_copy_in_current_exception/test.cpp b/tests/std/tests/VSO_0104705_throwing_copy_in_current_exception/test.cpp index 1b1d7d23ef6..9574e0014f5 100644 --- a/tests/std/tests/VSO_0104705_throwing_copy_in_current_exception/test.cpp +++ b/tests/std/tests/VSO_0104705_throwing_copy_in_current_exception/test.cpp @@ -58,6 +58,7 @@ struct EvilException<0> : LifetimeTracker> {}; // and rethrow_exception (unclear compliance with the standard; P1675 looks to make it allowed) int main() { +#if !(defined(__clang__) && defined(_M_IX86)) // TRANSITION, LLVM-158302 try { throw EvilException<0>(); // copy 1 } catch (...) { @@ -117,4 +118,5 @@ int main() { } } assert(BasicLifetimeTracker::allAlive == 0); +#endif // ^^^ no workaround ^^^ } From e22129fda21a35d8623abfba1916efacde830116 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 10:59:47 -0700 Subject: [PATCH 30/62] Remove workarounds for LLVM-94118. --- stl/inc/cmath | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/stl/inc/cmath b/stl/inc/cmath index 7190d446064..3028e21ba84 100644 --- a/stl/inc/cmath +++ b/stl/inc/cmath @@ -605,33 +605,32 @@ _STD _Common_float_type_t<_Ty1, _Ty2> remquo(_Ty1 _Left, _Ty2 _Right, int* _Pquo } // Updated by P0533R9 "constexpr For And ". -// TRANSITION, Clang 20: The builtins were made constexpr by LLVM-94118. -#define _CLANG_BUILTIN2_ARG(NAME, ARG) \ - _NODISCARD _Check_return_ inline bool NAME(_In_ ARG _Xx, _In_ ARG _Yx) noexcept /* strengthened */ { \ - return __builtin_##NAME(_Xx, _Yx); \ +#define _CLANG_BUILTIN2_ARG(NAME, ARG) \ + _NODISCARD _Check_return_ constexpr bool NAME(_In_ ARG _Xx, _In_ ARG _Yx) noexcept /* strengthened */ { \ + return __builtin_##NAME(_Xx, _Yx); \ } -#define _CLANG_BUILTIN2_ARG_TEMPLATED(NAME, ARG) \ - template , int> = 0> \ - _NODISCARD _Check_return_ inline bool NAME(_In_ ARG _Xx, _In_ _Ty _Yx) noexcept /* strengthened */ { \ - return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx)); \ +#define _CLANG_BUILTIN2_ARG_TEMPLATED(NAME, ARG) \ + template , int> = 0> \ + _NODISCARD _Check_return_ constexpr bool NAME(_In_ ARG _Xx, _In_ _Ty _Yx) noexcept /* strengthened */ { \ + return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx)); \ } #ifdef __cpp_char8_t -#define _CLANG_BUILTIN2_ARG_TEMPLATED_CHAR8_T(NAME) \ - template , int> = 0> \ - _NODISCARD _Check_return_ inline bool NAME(_In_ char8_t _Xx, _In_ _Ty _Yx) noexcept /* strengthened */ { \ - return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx)); \ +#define _CLANG_BUILTIN2_ARG_TEMPLATED_CHAR8_T(NAME) \ + template , int> = 0> \ + _NODISCARD _Check_return_ constexpr bool NAME(_In_ char8_t _Xx, _In_ _Ty _Yx) noexcept /* strengthened */ { \ + return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx)); \ } #else // ^^^ defined(__cpp_char8_t) / !defined(__cpp_char8_t) vvv #define _CLANG_BUILTIN2_ARG_TEMPLATED_CHAR8_T(NAME) #endif // ^^^ !defined(__cpp_char8_t) ^^^ #ifdef _NATIVE_WCHAR_T_DEFINED -#define _CLANG_BUILTIN2_ARG_TEMPLATED_WCHAR_T(NAME) \ - template , int> = 0> \ - _NODISCARD _Check_return_ inline bool NAME(_In_ wchar_t _Xx, _In_ _Ty _Yx) noexcept /* strengthened */ { \ - return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx)); \ +#define _CLANG_BUILTIN2_ARG_TEMPLATED_WCHAR_T(NAME) \ + template , int> = 0> \ + _NODISCARD _Check_return_ constexpr bool NAME(_In_ wchar_t _Xx, _In_ _Ty _Yx) noexcept /* strengthened */ { \ + return __builtin_##NAME(static_cast(_Xx), static_cast(_Yx)); \ } #else // ^^^ defined(_NATIVE_WCHAR_T_DEFINED) / !defined(_NATIVE_WCHAR_T_DEFINED) vvv #define _CLANG_BUILTIN2_ARG_TEMPLATED_WCHAR_T(NAME) From 34450b8c3bd2a7d4f376ad1973c7eda567ad7f62 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 11:03:47 -0700 Subject: [PATCH 31/62] Remove workarounds for LLVM-56507. --- tests/std/tests/P0912R5_coroutine/test.cpp | 4 ---- tests/std/tests/P2502R2_generator/test.cpp | 5 ----- tests/std/tests/P2502R2_generator_death/test.cpp | 5 ----- tests/std/tests/P2502R2_generator_iterator/test.cpp | 5 ----- tests/std/tests/P2502R2_generator_promise/test.cpp | 2 -- 5 files changed, 21 deletions(-) diff --git a/tests/std/tests/P0912R5_coroutine/test.cpp b/tests/std/tests/P0912R5_coroutine/test.cpp index 287e68dcc19..f026dffafe9 100644 --- a/tests/std/tests/P0912R5_coroutine/test.cpp +++ b/tests/std/tests/P0912R5_coroutine/test.cpp @@ -89,7 +89,6 @@ struct Task { coroutine_handle coro; }; -#if !(defined(__clang__) && defined(_M_IX86)) // TRANSITION, LLVM-56507 Task triangular_number(const int n) { if (n == 0) { co_return 0; @@ -97,7 +96,6 @@ Task triangular_number(const int n) { co_return n + co_await triangular_number(n - 1); } -#endif // ^^^ no workaround ^^^ void test_noop_handle() { // Validate noop_coroutine_handle const noop_coroutine_handle noop = noop_coroutine(); @@ -157,7 +155,6 @@ void test_noop_handle() { // Validate noop_coroutine_handle } int main() { -#if !(defined(__clang__) && defined(_M_IX86)) // TRANSITION, LLVM-56507 assert(g_tasks_destroyed == 0); { @@ -182,7 +179,6 @@ int main() { } assert(g_tasks_destroyed == 11); // triangular_number() called for [0, 10] -#endif // ^^^ no workaround ^^^ { // Also test GH-1422: hash>::operator() must be const diff --git a/tests/std/tests/P2502R2_generator/test.cpp b/tests/std/tests/P2502R2_generator/test.cpp index 7c7b8f4b9d5..5b7fbaa2e3c 100644 --- a/tests/std/tests/P2502R2_generator/test.cpp +++ b/tests/std/tests/P2502R2_generator/test.cpp @@ -1,10 +1,6 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#if defined(__clang__) && defined(_M_IX86) // TRANSITION, LLVM-56507 -int main() {} -#else // ^^^ workaround / no workaround vvv - #include #include #include @@ -414,4 +410,3 @@ int main() { dynamic_allocator_test(); pmr_generator_test(); } -#endif // ^^^ no workaround ^^^ diff --git a/tests/std/tests/P2502R2_generator_death/test.cpp b/tests/std/tests/P2502R2_generator_death/test.cpp index 990f5639e7f..6db8f1cf030 100644 --- a/tests/std/tests/P2502R2_generator_death/test.cpp +++ b/tests/std/tests/P2502R2_generator_death/test.cpp @@ -1,10 +1,6 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#if defined(__clang__) && defined(_M_IX86) // TRANSITION, LLVM-56507 -int main() {} -#else // ^^^ workaround / no workaround vvv - #include #include @@ -52,4 +48,3 @@ int main(int argc, char** argv) { return exec.run(argc, argv); } -#endif // ^^^ no workaround ^^^ diff --git a/tests/std/tests/P2502R2_generator_iterator/test.cpp b/tests/std/tests/P2502R2_generator_iterator/test.cpp index 8f24d231dbb..f8a23054660 100644 --- a/tests/std/tests/P2502R2_generator_iterator/test.cpp +++ b/tests/std/tests/P2502R2_generator_iterator/test.cpp @@ -1,10 +1,6 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#if defined(__clang__) && defined(_M_IX86) // TRANSITION, LLVM-56507 -int main() {} -#else // ^^^ workaround / no workaround vvv - #include #include #include @@ -172,4 +168,3 @@ int main() { test_with_type(); test_with_type(); } -#endif // ^^^ no workaround ^^^ diff --git a/tests/std/tests/P2502R2_generator_promise/test.cpp b/tests/std/tests/P2502R2_generator_promise/test.cpp index ea1c71c10ef..ace8b8f5d38 100644 --- a/tests/std/tests/P2502R2_generator_promise/test.cpp +++ b/tests/std/tests/P2502R2_generator_promise/test.cpp @@ -227,14 +227,12 @@ struct Holder { struct Incomplete; #endif // ^^^ no workaround ^^^ -#if !(defined(__clang__) && defined(_M_IX86)) // TRANSITION, LLVM-56507 // Also test LWG-4119: // "generator::promise_type::yield_value(ranges::elements_of)'s nested generator may be ill-formed" generator> test_lwg_4119() { // COMPILE-ONLY vector> v; co_yield ranges::elements_of(v); } -#endif // ^^^ no workaround ^^^ int main() { test_with_type(); From 7d6919f3ee117cb541f0895ee09a2d29ec77b900 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Sep 2025 11:08:14 -0700 Subject: [PATCH 32/62] Remove workaround for LLVM-104189. --- .../test.compile.pass.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/std/tests/P2374R4_views_cartesian_product_recommended_practices/test.compile.pass.cpp b/tests/std/tests/P2374R4_views_cartesian_product_recommended_practices/test.compile.pass.cpp index d742c9cb895..2263873c895 100644 --- a/tests/std/tests/P2374R4_views_cartesian_product_recommended_practices/test.compile.pass.cpp +++ b/tests/std/tests/P2374R4_views_cartesian_product_recommended_practices/test.compile.pass.cpp @@ -175,11 +175,7 @@ constexpr void check_single_view() { enum class CheckConstAdaptor : bool { no, yes }; -#ifdef __clang__ // TRANSITION, LLVM-104189 -template