diff --git a/.github/ISSUE_TEMPLATE/cxx20-feature.md b/.github/ISSUE_TEMPLATE/cxx23-feature.md similarity index 70% rename from .github/ISSUE_TEMPLATE/cxx20-feature.md rename to .github/ISSUE_TEMPLATE/cxx23-feature.md index c7b3749aa2b..399071c4475 100644 --- a/.github/ISSUE_TEMPLATE/cxx20-feature.md +++ b/.github/ISSUE_TEMPLATE/cxx23-feature.md @@ -1,8 +1,8 @@ --- -name: cxx20 Feature +name: cxx23 Feature about: For STL maintainers only title: PAPER_NUMBER PAPER_TITLE -labels: cxx20 +labels: cxx23 assignees: '' --- @@ -22,3 +22,8 @@ the https://wg21.link redirector will start working. Feature-test macro: `#define MACRO_NAME MACRO_VALUE` + +Note: We're still working on finishing C++20. Until we're done +with that (and the compiler implements distinct `/std:c++20` and +`/std:c++latest` options), we won't be able to review PRs for +C++23 features. diff --git a/CMakeLists.txt b/CMakeLists.txt index 5029bd03aec..a96985b708d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if (NOT DEFINED CMAKE_TOOLCHAIN_FILE AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/vcpkg set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake") endif() -cmake_minimum_required(VERSION 3.17) +cmake_minimum_required(VERSION 3.18) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) project(msvc_standard_libraries LANGUAGES CXX) diff --git a/README.md b/README.md index 0a31b882771..6cfb740f8a7 100644 --- a/README.md +++ b/README.md @@ -143,10 +143,10 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem The STL uses boost-math headers to provide P0226R1 Mathematical Special Functions. We recommend using [vcpkg][] to acquire this dependency. -1. Install Visual Studio 2019 16.8 Preview 5 or later. +1. Install Visual Studio 2019 16.9 Preview 1 or later. * 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.17 or later, and [Ninja][] 1.8.2 or later. + * Otherwise, install [CMake][] 3.18 or later, and [Ninja][] 1.8.2 or later. 2. 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". @@ -158,10 +158,10 @@ acquire this dependency. # How To Build With A Native Tools Command Prompt -1. Install Visual Studio 2019 16.8 Preview 5 or later. +1. Install Visual Studio 2019 16.9 Preview 1 or later. * 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.17 or later, and [Ninja][] 1.8.2 or later. + * Otherwise, install [CMake][] 3.18 or later, and [Ninja][] 1.8.2 or later. 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` diff --git a/azure-devops/create-vmss.ps1 b/azure-devops/create-vmss.ps1 index 797e00f20c0..1434ce0ac48 100644 --- a/azure-devops/create-vmss.ps1 +++ b/azure-devops/create-vmss.ps1 @@ -25,7 +25,7 @@ $LiveVMPrefix = 'BUILD' $WindowsServerSku = '2019-Datacenter' $ProgressActivity = 'Creating Scale Set' -$TotalProgress = 11 +$TotalProgress = 12 $CurrentProgress = 1 <# @@ -159,6 +159,14 @@ function Wait-Shutdown { } +#################################################################################################### +Write-Progress ` + -Activity $ProgressActivity ` + -Status 'Setting the subscription context' ` + -PercentComplete (100 / $TotalProgress * $CurrentProgress++) + +Set-AzContext -SubscriptionName CPP_STL_GitHub + #################################################################################################### Write-Progress ` -Activity $ProgressActivity ` @@ -391,6 +399,4 @@ New-AzVmss ` Write-Progress -Activity $ProgressActivity -Completed Write-Host "Location: $Location" Write-Host "Resource group name: $ResourceGroupName" -Write-Host "User name: AdminUser" -Write-Host "Using generated password: $AdminPW" Write-Host 'Finished!' diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index ea84e185ab1..d09d0e6db72 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -88,6 +88,9 @@ $Workloads = @( 'Microsoft.VisualStudio.Component.VC.CMake.Project', 'Microsoft.VisualStudio.Component.VC.CoreIde', 'Microsoft.VisualStudio.Component.VC.Llvm.Clang', + 'Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre', + 'Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre', + 'Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre', 'Microsoft.VisualStudio.Component.VC.Tools.ARM', 'Microsoft.VisualStudio.Component.VC.Tools.ARM64', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', @@ -99,6 +102,9 @@ $Sku = 'Enterprise' $VisualStudioBootstrapperUrl = 'https://aka.ms/vs/16/pre/vs_enterprise.exe' $PythonUrl = 'https://www.python.org/ftp/python/3.9.0/python-3.9.0-amd64.exe' +# https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk +$WindowsDriverKitUrl = 'https://go.microsoft.com/fwlink/?linkid=2128854' + $CudaUrl = ` 'https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_426.00_win10.exe' $CudaFeatures = 'nvcc_10.1 cuobjdump_10.1 nvprune_10.1 cupti_10.1 gpu_library_advisor_10.1 memcheck_10.1 ' + ` @@ -223,6 +229,36 @@ Function InstallPython { } } +<# +.SYNOPSIS +Installs the Windows Driver Kit. + +.DESCRIPTION +InstallWindowsDriverKit installs the Windows Driver Kit from the supplied URL. + +.PARAMETER Url +The URL of the Windows Driver Kit installer. +#> +Function InstallWindowsDriverKit { + Param( + [String]$Url + ) + + Write-Host 'Downloading the Windows Driver Kit...' + [string]$installerPath = Get-TempFilePath -Extension 'exe' + curl.exe -L -o $installerPath -s -S $Url + Write-Host 'Installing the Windows Driver Kit...' + $proc = Start-Process -FilePath $installerPath -ArgumentList ` + @('/quiet', '/features', 'OptionId.WindowsDriverKitComplete') -Wait -PassThru + $exitCode = $proc.ExitCode + if ($exitCode -eq 0) { + Write-Host 'Installation successful!' + } + else { + Write-Error "Installation failed! Exited with $exitCode." + } +} + <# .SYNOPSIS Installs NVIDIA's CUDA Toolkit. @@ -300,6 +336,7 @@ Add-MpPreference -ExclusionProcess python.exe InstallPython $PythonUrl InstallVisualStudio -Workloads $Workloads -BootstrapperUrl $VisualStudioBootstrapperUrl +InstallWindowsDriverKit $WindowsDriverKitUrl InstallCuda -Url $CudaUrl -Features $CudaFeatures Write-Host 'Updating PATH...' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 71a79fe47eb..8530fa6b2ef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,7 +6,7 @@ variables: tmpDir: 'D:\Temp' -pool: 'StlBuild-2020-10-23' +pool: 'StlBuild-2020-11-10' stages: - stage: Code_Format diff --git a/stl/inc/filesystem b/stl/inc/filesystem index 948ac146e73..52e41e51fec 100644 --- a/stl/inc/filesystem +++ b/stl/inc/filesystem @@ -622,7 +622,6 @@ namespace filesystem { _NODISCARD inline bool _Is_drive_prefix_with_slash_slash_question(const wstring_view _Text) { // test if _Text starts with a \\?\X: prefix - using namespace _STD string_view_literals; // TRANSITION, VSO-571749 return _Text.size() >= 6 && _Text._Starts_with(LR"(\\?\)"sv) && _Is_drive_prefix(_Text.data() + 4); } @@ -1250,8 +1249,6 @@ namespace filesystem { } _NODISCARD path lexically_normal() const { - using namespace _STD string_view_literals; // TRANSITION, VSO-571749 - constexpr wstring_view _Dot = L"."sv; constexpr wstring_view _Dot_dot = L".."sv; @@ -1686,8 +1683,6 @@ namespace filesystem { } _NODISCARD inline path path::lexically_relative(const path& _Base) const { - using namespace _STD string_view_literals; // TRANSITION, VSO-571749 - constexpr wstring_view _Dot = L"."sv; constexpr wstring_view _Dot_dot = L".."sv; @@ -1810,7 +1805,6 @@ namespace filesystem { private: static string _Pretty_message(const string_view _Op, const path& _Path1, const path& _Path2 = {}) { - using namespace _STD string_view_literals; // TRANSITION, VSO-571749 string _Result; // Convert the paths to narrow encoding in a way that gracefully handles non-encodable characters const auto _Code_page = __std_fs_code_page(); @@ -2550,7 +2544,6 @@ namespace filesystem { _NODISCARD static __std_win_error _Open_dir( path& _Path, const directory_options _Options_arg, _Find_file_handle& _Dir, __std_fs_find_data& _Data) { - using namespace _STD string_view_literals; // TRANSITION, VSO-571749 const size_t _Null_term_len = _CSTD wcslen(_Path.c_str()); if (_Null_term_len == 0 || _Null_term_len != _Path.native().size()) { return __std_win_error::_File_not_found; @@ -3021,7 +3014,6 @@ namespace filesystem { // FUNCTION canonical _NODISCARD inline __std_win_error _Canonical(path& _Result, const wstring& _Text) { // pre: _Result.empty() - using namespace _STD string_view_literals; // TRANSITION, VSO-571749 if (_Text.empty()) { return __std_win_error::_Success; } diff --git a/stl/inc/memory_resource b/stl/inc/memory_resource index 3aebab8a602..bb47641ee87 100644 --- a/stl/inc/memory_resource +++ b/stl/inc/memory_resource @@ -661,7 +661,7 @@ namespace pmr { } protected: - virtual void* do_allocate(size_t _Bytes, size_t _Align) override { // TRANSITION, DevCom-1159869 + virtual void* do_allocate(const size_t _Bytes, const size_t _Align) override { // allocate from the current buffer or a new larger buffer from upstream if (!_STD align(_Align, _Bytes, _Current_buffer, _Space_available)) { _Increase_capacity(_Bytes, _Align); diff --git a/stl/inc/tuple b/stl/inc/tuple index 7060e6968bd..bdb3aaed54d 100644 --- a/stl/inc/tuple +++ b/stl/inc/tuple @@ -684,6 +684,9 @@ public: template friend constexpr const tuple_element_t<_Index, tuple<_Types...>>&& get(const tuple<_Types...>&& _Tuple) noexcept; + template + friend constexpr auto&& _Tuple_get(tuple<_Types...>&& _Tuple) noexcept; + template friend constexpr _Ty& get(tuple<_Types...>& _Tuple) noexcept; @@ -796,6 +799,14 @@ _NODISCARD constexpr const tuple_element_t<_Index, tuple<_Types...>>&& get(const return static_cast(static_cast(_Tuple)._Myfirst._Val); } +template +_NODISCARD constexpr auto&& _Tuple_get(tuple<_Types...>&& _Tuple) noexcept { + // used by pair's piecewise constructor + using _Ty = tuple_element_t<_Index, tuple<_Types...>>; + using _Ttype = typename tuple_element<_Index, tuple<_Types...>>::_Ttype; + return static_cast<_Ty&&>(static_cast<_Ttype&>(_Tuple)._Myfirst._Val); +} + // FUNCTION TEMPLATE get (by type) template _NODISCARD constexpr _Ty& get(tuple<_Types...>& _Tuple) noexcept { @@ -971,19 +982,6 @@ _NODISCARD constexpr _Ty make_from_tuple(_Tuple&& _Tpl) { // construct _Ty from } #endif // _HAS_CXX17 -// TEMPLATE CONSTRUCTOR pair::pair(tuple, tuple, sequence, sequence) -template -template -constexpr pair<_Ty1, _Ty2>::pair( - _Tuple1& _Val1, _Tuple2& _Val2, index_sequence<_Indexes1...>, index_sequence<_Indexes2...>) - : first(_STD get<_Indexes1>(_STD move(_Val1))...), second(_STD get<_Indexes2>(_STD move(_Val2))...) {} - -// TEMPLATE CONSTRUCTOR pair::pair(piecewise_construct_t, tuple, tuple) -template -template -_CONSTEXPR20 pair<_Ty1, _Ty2>::pair(piecewise_construct_t, tuple<_Types1...> _Val1, tuple<_Types2...> _Val2) - : pair(_Val1, _Val2, index_sequence_for<_Types1...>{}, index_sequence_for<_Types2...>{}) {} - // STRUCT TEMPLATE uses_allocator template struct uses_allocator, _Alloc> : true_type {}; // true_type if container allocator enabled diff --git a/stl/inc/utility b/stl/inc/utility index 53e38b608af..cc191b85356 100644 --- a/stl/inc/utility +++ b/stl/inc/utility @@ -123,6 +123,9 @@ _INLINE_VAR constexpr piecewise_construct_t piecewise_construct{}; template class tuple; +template +_NODISCARD constexpr auto&& _Tuple_get(tuple<_Types...>&& _Tuple) noexcept; + template struct pair { // store a pair of values using first_type = _Ty1; @@ -263,10 +266,12 @@ struct pair { // store a pair of values #endif // ^^^ !_HAS_CONDITIONAL_EXPLICIT ^^^ template - constexpr pair(_Tuple1& _Val1, _Tuple2& _Val2, index_sequence<_Indexes1...>, index_sequence<_Indexes2...>); + constexpr pair(_Tuple1& _Val1, _Tuple2& _Val2, index_sequence<_Indexes1...>, index_sequence<_Indexes2...>) + : first(_Tuple_get<_Indexes1>(_STD move(_Val1))...), second(_Tuple_get<_Indexes2>(_STD move(_Val2))...) {} template - _CONSTEXPR20 pair(piecewise_construct_t, tuple<_Types1...> _Val1, tuple<_Types2...> _Val2); + _CONSTEXPR20 pair(piecewise_construct_t, tuple<_Types1...> _Val1, tuple<_Types2...> _Val2) + : pair(_Val1, _Val2, index_sequence_for<_Types1...>{}, index_sequence_for<_Types2...>{}) {} pair& operator=(const volatile pair&) = delete; diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 66410d27b3f..c4be5ea8b38 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1184,12 +1184,8 @@ #define __cpp_lib_constexpr_tuple 201811L #define __cpp_lib_constexpr_utility 201811L -#ifdef __cpp_impl_coroutine // TRANSITION, Clang and EDG coroutine support -#if __cpp_impl_coroutine >= 201902L +#ifdef __cpp_impl_coroutine // TRANSITION, Clang coroutine support #define __cpp_lib_coroutine 201902L -#else // ^^^ __cpp_impl_coroutine >= 201902L ^^^ / vvv __cpp_impl_coroutine < 201902L vvv -#define __cpp_lib_coroutine 197000L // TRANSITION, VS 2019 16.8 Preview 4 -#endif // ^^^ __cpp_impl_coroutine < 201902L ^^^ #endif // __cpp_impl_coroutine #define __cpp_lib_destroying_delete 201806L diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index f4855a8b0cb..86731f4c4d2 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -501,7 +501,7 @@ std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp FAIL std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp FAIL std/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp FAIL -std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp FAIL +std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp:1 FAIL std/utilities/memory/specialized.algorithms/specialized.construct/construct_at.pass.cpp FAIL std/utilities/memory/specialized.algorithms/specialized.destroy/destroy.pass.cpp FAIL std/utilities/memory/specialized.algorithms/specialized.destroy/destroy_at.pass.cpp FAIL diff --git a/tests/std/tests/P0433R2_deduction_guides/test.cpp b/tests/std/tests/P0433R2_deduction_guides/test.cpp index dd11ad849d9..6a819a3216f 100644 --- a/tests/std/tests/P0433R2_deduction_guides/test.cpp +++ b/tests/std/tests/P0433R2_deduction_guides/test.cpp @@ -91,14 +91,12 @@ long add(short x, int y) { return x + y; } -struct UniqueTagCanDeduceFrom {}; // TRANSITION, VSO-587956 - template class ClassTemplate, typename... CtorArgs> struct CanDeduceFromHelper : false_type {}; template