diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 13aae520361..193077082e0 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -7,13 +7,13 @@ assignees: '' --- -**Describe the bug** +# Describe the bug A clear and concise description of what the bug is. Please check that you've read the guidelines for submitting STL bug reports in `README.md`. If you are having problems with any component that is not the STL, instructions to get to the right place are there. -**Command-line test case** +# Command-line test case ``` C:\Temp>type repro.cpp #include @@ -26,12 +26,18 @@ int main() { std::cout << "test failure\n"; } -C:\Temp>cl /EHsc /W4 /WX .\repro.cpp -Microsoft (R) C/C++ Optimizing Compiler Version 19.23.28019.1 for x64 +C:\Temp>cl /EHsc /W4 /WX /std:c++latest .\repro.cpp +Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32522 for x64 Copyright (C) Microsoft Corporation. All rights reserved. +/std:c++latest is provided as a preview of language features from the latest C++ +working draft, and we're eager to hear about bugs and suggestions for improvements. +However, note that these features are provided as-is without support, and subject +to changes or removal as the working draft evolves. See +https://go.microsoft.com/fwlink/?linkid=2045807 for details. + repro.cpp -Microsoft (R) Incremental Linker Version 14.23.28019.1 +Microsoft (R) Incremental Linker Version 14.36.32522.0 Copyright (C) Microsoft Corporation. All rights reserved. /out:repro.exe @@ -41,25 +47,24 @@ C:\Temp>.\repro.exe test failure ``` -**Expected behavior** +# Expected behavior A clear and concise description of what you expected to happen. Alternatively, include `static_assert` or `assert` lines in your test case above whose failure clearly indicates the problem. -**STL version** +# STL version * Option 1: Visual Studio version - * Displayed in Help > About Microsoft Visual Studio - * Example: + + Help > About Microsoft Visual Studio > Copy Info, we need only the first two lines + + Example: ``` - Microsoft Visual Studio Community 2019 Preview - Version 16.5.0 Preview 5.0 + Microsoft Visual Studio Community 2022 + Version 17.6.0 Preview 3.0 ``` - * Option 2: git commit hash - * Example: + + Example: ``` https://github.com/microsoft/STL/commit/2195148 ``` -**Additional context** +# Additional context Add any other context about the problem here. diff --git a/CMakeLists.txt b/CMakeLists.txt index 17ebf7456f3..ad971dad468 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.25.2) +cmake_minimum_required(VERSION 3.26.0) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) project(msvc_standard_libraries LANGUAGES CXX) diff --git a/README.md b/README.md index 6e48b4eb109..af9dd095d39 100644 --- a/README.md +++ b/README.md @@ -141,11 +141,11 @@ 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.6 Preview 1 or later. +1. Install Visual Studio 2022 17.6 Preview 3 or later. * Select "Windows 11 SDK (10.0.22000.0)" in the VS Installer. * 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.25.2 or later, and [Ninja][] 1.11.0 or later. + * Otherwise, install [CMake][] 3.26.0 or later, and [Ninja][] 1.11.0 or later. * We recommend selecting "Python 3 64-bit" in the VS Installer. * Otherwise, make sure [Python][] 3.9 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, @@ -157,11 +157,11 @@ 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.6 Preview 1 or later. +1. Install Visual Studio 2022 17.6 Preview 3 or later. * Select "Windows 11 SDK (10.0.22000.0)" in the VS Installer. * 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.25.2 or later, and [Ninja][] 1.11.0 or later. + * Otherwise, install [CMake][] 3.26.0 or later, and [Ninja][] 1.11.0 or later. * We recommend selecting "Python 3 64-bit" in the VS Installer. * Otherwise, make sure [Python][] 3.9 or later is available to CMake. 2. Open a command prompt. diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index aad0f0b722e..232464f305f 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -11,9 +11,6 @@ See https://github.com/microsoft/STL/wiki/Checklist-for-Toolset-Updates for more $ErrorActionPreference = 'Stop' -# https://aka.ms/azps-changewarnings -$Env:SuppressAzurePowerShellBreakingChangeWarnings = 'true' - $CurrentDate = Get-Date $Location = 'eastus' @@ -24,7 +21,7 @@ $ImageOffer = 'WindowsServer' $ImageSku = '2022-datacenter-g2' $ProgressActivity = 'Preparing STL CI pool' -$TotalProgress = 25 +$TotalProgress = 26 $CurrentProgress = 1 <# @@ -120,6 +117,13 @@ function Wait-Shutdown { } } +#################################################################################################### +Display-ProgressBar -Status 'Silencing breaking change warnings' + +# https://aka.ms/azps-changewarnings +Update-AzConfig ` + -DisplayBreakingChangeWarning $false ` + -Scope 'Process' | Out-Null #################################################################################################### Display-ProgressBar -Status 'Setting the subscription context' @@ -207,6 +211,15 @@ $VM = Set-AzVMBootDiagnostic ` -VM $VM ` -Disable +$VM = Set-AzVMSecurityProfile ` + -VM $VM ` + -SecurityType 'TrustedLaunch' + +$VM = Set-AzVMUefi ` + -VM $VM ` + -EnableVtpm $true ` + -EnableSecureBoot $true + New-AzVm ` -ResourceGroupName $ResourceGroupName ` -Location $Location ` @@ -305,6 +318,7 @@ New-AzGalleryImageDefinition ` -Publisher $ImagePublisher ` -Offer $ImageOffer ` -Sku $ImageSku ` + -Feature @(@{ Name = 'SecurityType'; Value = 'TrustedLaunch'; }) ` -HyperVGeneration 'V2' | Out-Null #################################################################################################### diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index c0da5f4b8d4..c5731b52fb1 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -91,7 +91,7 @@ if ([string]::IsNullOrEmpty($AdminUserPassword)) { $PsExecPath = Join-Path $ExtractedPsToolsPath 'PsExec64.exe' # https://github.com/PowerShell/PowerShell/releases/latest - $PowerShellZipUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.3.2/PowerShell-7.3.2-win-x64.zip' + $PowerShellZipUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.3.3/PowerShell-7.3.3-win-x64.zip' Write-Host "Downloading: $PowerShellZipUrl" $ExtractedPowerShellPath = DownloadAndExtractZip -Url $PowerShellZipUrl $PwshPath = Join-Path $ExtractedPowerShellPath 'pwsh.exe' @@ -128,9 +128,6 @@ $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.ARM64EC', @@ -138,10 +135,8 @@ $Workloads = @( 'Microsoft.VisualStudio.Component.Windows11SDK.22000' ) -$ReleaseInPath = 'Preview' -$Sku = 'Enterprise' $VisualStudioBootstrapperUrl = 'https://aka.ms/vs/17/pre/vs_enterprise.exe' -$PythonUrl = 'https://www.python.org/ftp/python/3.11.2/python-3.11.2-amd64.exe' +$PythonUrl = 'https://www.python.org/ftp/python/3.11.3/python-3.11.3-amd64.exe' $CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda_11.6.0_511.23_windows.exe' @@ -187,19 +182,11 @@ The set of VS workloads to install. .PARAMETER BootstrapperUrl The URL of the Visual Studio installer, i.e. one of vs_*.exe. - -.PARAMETER InstallPath -The path to install Visual Studio at. - -.PARAMETER Nickname -The nickname to give the installation. #> Function InstallVisualStudio { Param( [String[]]$Workloads, - [String]$BootstrapperUrl, - [String]$InstallPath = $null, - [String]$Nickname = $null + [String]$BootstrapperUrl ) try { @@ -213,16 +200,6 @@ Function InstallVisualStudio { $args += $workload } - if (-not ([String]::IsNullOrWhiteSpace($InstallPath))) { - $args += '--installpath' - $args += $InstallPath - } - - if (-not ([String]::IsNullOrWhiteSpace($Nickname))) { - $args += '--nickname' - $args += $Nickname - } - $proc = Start-Process -FilePath cmd.exe -ArgumentList $args -Wait -PassThru PrintMsiExitCodeMessage $proc.ExitCode } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9a0f22ce43c..5baa036c05a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,7 +9,7 @@ variables: benchmarkBuildOutputLocation: 'D:\benchmark' pool: - name: 'StlBuild-2023-02-21T1058-Pool' + name: 'StlBuild-2023-04-11T1428-Pool' demands: EnableSpotVM -equals true pr: diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 594b1db0c3c..cc188710c1c 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -cmake_minimum_required(VERSION 3.25.2) +cmake_minimum_required(VERSION 3.26.0) project(msvc_standard_libraries_benchmarks LANGUAGES CXX) if(DEFINED STL_BINARY_DIR) diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt index b3297579ea0..64ee93e9055 100644 --- a/stl/CMakeLists.txt +++ b/stl/CMakeLists.txt @@ -502,7 +502,7 @@ set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "Embedded") add_compile_options(/WX /Gy "$<$:/diagnostics:caret;/W4;/w14265;/w15038;/fastfail;/guard:cf;/Zp8;/std:c++latest;/permissive-;/Zc:threadSafeInit-;/Zl>" - "$<$:/W3;/nologo>" + "$<$:/W3;/nologo;/quiet>" ) include_directories(BEFORE diff --git a/stl/inc/array b/stl/inc/array index 8eab5545113..1a04e3bbb73 100644 --- a/stl/inc/array +++ b/stl/inc/array @@ -406,6 +406,9 @@ struct pointer_traits<_Array_iterator<_Ty, _Size>> { _EXPORT_STD template class array { // fixed size array of values public: + static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); + using value_type = _Ty; using size_type = size_t; using difference_type = ptrdiff_t; @@ -592,6 +595,9 @@ struct _Empty_array_element {}; template class array<_Ty, 0> { public: + static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); + using value_type = _Ty; using size_type = size_t; using difference_type = ptrdiff_t; @@ -769,11 +775,7 @@ _CONSTEXPR20 void swap(array<_Ty, _Size>& _Left, array<_Ty, _Size>& _Right) noex _EXPORT_STD template _NODISCARD _CONSTEXPR20 bool operator==(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) { -#ifdef __EDG__ // TRANSITION, VSO-1161663 - return _STD equal(_Left.begin(), _Left.end(), _Right.begin()); -#else // ^^^ workaround / no workaround vvv return _STD equal(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin()); -#endif // ^^^ no workaround ^^^ } #if !_HAS_CXX20 @@ -787,23 +789,14 @@ _NODISCARD bool operator!=(const array<_Ty, _Size>& _Left, const array<_Ty, _Siz _EXPORT_STD template _NODISCARD constexpr _Synth_three_way_result<_Ty> operator<=>( const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) { -#ifdef __EDG__ // TRANSITION, VSO-1161663 - return _STD lexicographical_compare_three_way( - _Left.begin(), _Left.end(), _Right.begin(), _Right.end(), _Synth_three_way{}); -#else // ^^^ workaround / no workaround vvv return _STD lexicographical_compare_three_way(_Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin(), _Right._Unchecked_end(), _Synth_three_way{}); -#endif // ^^^ no workaround ^^^ } #else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv template _NODISCARD _CONSTEXPR20 bool operator<(const array<_Ty, _Size>& _Left, const array<_Ty, _Size>& _Right) { -#ifdef __EDG__ // TRANSITION, VSO-1161663 - return _STD lexicographical_compare(_Left.begin(), _Left.end(), _Right.begin(), _Right.end()); -#else // ^^^ workaround / no workaround vvv return _STD lexicographical_compare( _Left._Unchecked_begin(), _Left._Unchecked_end(), _Right._Unchecked_begin(), _Right._Unchecked_end()); -#endif // ^^^ no workaround ^^^ } template diff --git a/stl/inc/atomic b/stl/inc/atomic index ebef69084d8..e4043659949 100644 --- a/stl/inc/atomic +++ b/stl/inc/atomic @@ -56,11 +56,11 @@ extern "C" _NODISCARD char __stdcall __std_atomic_has_cmpxchg16b() noexcept; // Controls whether ARM64 ldar/ldapr/stlr should be used #ifndef _STD_ATOMIC_USE_ARM64_LDAR_STLR #if defined(_M_ARM64) || defined(_M_ARM64EC) -#if defined(_HAS_ARM64_LOAD_ACQUIRE) && _HAS_ARM64_LOAD_ACQUIRE == 1 // TRANSITION, VS 2022 17.7 Preview 1 -#define _STD_ATOMIC_USE_ARM64_LDAR_STLR 1 -#else // ^^^ updated intrin0.inl.h is available / workaround vvv +#ifdef __clang__ // TRANSITION, LLVM-62103 #define _STD_ATOMIC_USE_ARM64_LDAR_STLR 0 -#endif // ^^^ workaround ^^^ +#else // ^^^ Clang doesn't support new intrinsics / __load_acquire/__stlr intrinsics are available vvv +#define _STD_ATOMIC_USE_ARM64_LDAR_STLR 1 +#endif // ^^^ __load_acquire/__stlr intrinsics are available ^^^ #else // ^^^ ARM64/ARM64EC / Other architectures vvv #define _STD_ATOMIC_USE_ARM64_LDAR_STLR 0 #endif // defined(_M_ARM64) || defined(_M_ARM64EC) @@ -141,7 +141,7 @@ extern "C" inline void _Check_memory_order(const unsigned int _Order) noexcept { #if _STD_ATOMIC_USE_ARM64_LDAR_STLR == 1 #define __LOAD_ACQUIRE_ARM64(_Width, _Ptr) \ - __load_acquire##_Width(reinterpret_cast(_Ptr)) + static_cast<__int##_Width>(__load_acquire##_Width(reinterpret_cast(_Ptr))) #define _ATOMIC_LOAD_ARM64(_Result, _Width, _Ptr, _Order_var) \ switch (_Order_var) { \ @@ -184,7 +184,8 @@ extern "C" inline void _Check_memory_order(const unsigned int _Order) noexcept { #define __STORE_RELEASE(_Width, _Ptr, _Desired) \ _Compiler_barrier(); \ - __stlr##_Width(reinterpret_cast(_Ptr), (_Desired)); + __stlr##_Width( \ + reinterpret_cast(_Ptr), static_cast(_Desired)); #else // ^^^ _STD_ATOMIC_USE_ARM64_LDAR_STLR == 1 ^^^ / vvv _STD_ATOMIC_USE_ARM64_LDAR_STLR == 0 vvv @@ -214,9 +215,10 @@ extern "C" inline void _Check_memory_order(const unsigned int _Order) noexcept { _Memory_barrier(); #if _STD_ATOMIC_USE_ARM64_LDAR_STLR == 1 -#define _ATOMIC_STORE_SEQ_CST_ARM64(_Width, _Ptr, _Desired) \ - _Compiler_barrier(); \ - __stlr##_Width(reinterpret_cast(_Ptr), (_Desired)); \ +#define _ATOMIC_STORE_SEQ_CST_ARM64(_Width, _Ptr, _Desired) \ + _Compiler_barrier(); \ + __stlr##_Width( \ + reinterpret_cast(_Ptr), static_cast(_Desired)); \ _Memory_barrier(); #else #define _ATOMIC_STORE_SEQ_CST_ARM64 _ATOMIC_STORE_SEQ_CST_ARM diff --git a/stl/inc/bit b/stl/inc/bit index 24830c31f61..430454a8631 100644 --- a/stl/inc/bit +++ b/stl/inc/bit @@ -12,6 +12,7 @@ _EMIT_STL_WARNING(STL4038, "The contents of are available only with C++20 or later."); #else // ^^^ !_HAS_CXX20 / _HAS_CXX20 vvv +#include #include #include #include diff --git a/stl/inc/chrono b/stl/inc/chrono index 202b9aa847b..088cba4c21d 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -4998,7 +4998,7 @@ namespace chrono { _Write_seconds(_Os, _Hh_mm_ss_part_underflow_to_zero(_Val)); } - _EXPORT_STD /* TRANSITION, VSO-1582358 */ template + template _NODISCARD tm _Fill_tm(const _Ty& _Val) { unsigned int _Day = 0; unsigned int _Month = 0; @@ -6011,7 +6011,7 @@ namespace chrono { template _NODISCARD string ambiguous_local_time::_Make_string(const local_time<_Duration>& _Tp, const local_info& _Info) { ostringstream _Os; - _Os << _Tp << " is ambiguous. It could be\n" + _Os << _Tp << " is ambiguous. It could be\n" << _Tp << ' ' << _Info.first.abbrev << " == " << _Tp - _Info.first.offset << " UTC or\n" << _Tp << ' ' << _Info.second.abbrev << " == " << _Tp - _Info.second.offset << " UTC"; return _STD move(_Os).str(); diff --git a/stl/inc/deque b/stl/inc/deque index 5667b19def2..1bbf465b2b9 100644 --- a/stl/inc/deque +++ b/stl/inc/deque @@ -575,6 +575,8 @@ private: friend _Tidy_guard; static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<_Ty, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("deque", "T")); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); using _Alty = _Rebind_alloc_t<_Alloc, _Ty>; using _Alty_traits = allocator_traits<_Alty>; diff --git a/stl/inc/exception b/stl/inc/exception index a635cdee180..4d3e300521a 100644 --- a/stl/inc/exception +++ b/stl/inc/exception @@ -9,6 +9,7 @@ #include #if _STL_COMPILER_PREPROCESSOR +#include #include #pragma pack(push, _CRT_PACKING) diff --git a/stl/inc/execution b/stl/inc/execution index e0b4df6e338..45ca79f8ec6 100644 --- a/stl/inc/execution +++ b/stl/inc/execution @@ -475,7 +475,7 @@ struct _Parallel_choose_max_chunk { } }; -_EXPORT_STD /* TRANSITION, VSO-1592329 */ template +template struct alignas(_Ty) alignas(size_t) alignas(_Atomic_counter_t) _Circular_buffer { // work stealing deque extent type static_assert(is_trivial_v<_Ty>, "Work stealing deques work only with trivial operations"); diff --git a/stl/inc/format b/stl/inc/format index 8787d5857ad..dd50c3a524f 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -168,39 +168,47 @@ concept _Parse_spec_callbacks = _Parse_align_callbacks<_Ty, _CharT> }; // clang-format on +template +struct _Decode_utf_result { + const _CharT* _Next_ptr; + bool _Is_unicode_scalar_value; // Also _Is_usv below, see https://www.unicode.org/glossary/#unicode_scalar_value +}; + // _Decode_utf decodes UTF-8 or UTF-16 encoded unsigned char or wchar_t strings respectively -_NODISCARD constexpr const wchar_t* _Decode_utf(const wchar_t* _First, const wchar_t* _Last, char32_t& _Val) noexcept { +_NODISCARD constexpr _Decode_utf_result _Decode_utf( + const wchar_t* _First, const wchar_t* _Last, char32_t& _Val) noexcept { _STL_INTERNAL_CHECK(_First < _Last); _Val = static_cast(*_First); if (_Val < 0xD800) { - return _First + 1; + return {_First + 1, true}; } else if (_Val <= 0xDBFF) { // 0xD800 <= _Val <= 0xDBFF: High surrogate if (_First + 1 == _Last) { _Val = 0xFFFD; - return _Last; + return {_Last, false}; } if (_First[1] < 0xDC00 || _First[1] > 0xDFFF) { // unpaired high surrogate _Val = 0xFFFD; - return _First + 1; + return {_First + 1, false}; } _Val = (_Val - 0xD800) << 10; _Val += _First[1] - 0xDC00; _Val += 0x10000; - return _First + 2; + return {_First + 2, true}; } else if (_Val <= 0xDFFF) { // unpaired low surrogate _Val = 0xFFFD; - return _First + 1; + return {_First + 1, false}; } - return _First + 1; + return {_First + 1, true}; } -_NODISCARD constexpr const char* _Decode_utf(const char* _First, const char* _Last, char32_t& _Val) noexcept { +_NODISCARD constexpr _Decode_utf_result _Decode_utf( + const char* _First, const char* _Last, char32_t& _Val) noexcept { _STL_INTERNAL_CHECK(_First < _Last); // Decode a UTF-8 encoded codepoint starting at _First and not exceeding _Last, returning // one past the end of the character decoded. Any invalid codepoints will result in @@ -217,7 +225,7 @@ _NODISCARD constexpr const char* _Decode_utf(const char* _First, const char* _La // we just sum the comparisons to get the number of trailing bytes. int _Num_bytes; if (_Val <= 0x7F) { - return _First + 1; + return {_First + 1, true}; } else if (_Val >= 0xC2 && _Val <= 0xDF) { _Num_bytes = 2; } else if (_Val >= 0xE0 && _Val <= 0xEF) { @@ -227,7 +235,7 @@ _NODISCARD constexpr const char* _Decode_utf(const char* _First, const char* _La } else { // definitely not valid _Val = 0xFFFD; - return _First + 1; + return {_First + 1, false}; } if (_First + 1 == _Last) { @@ -236,7 +244,7 @@ _NODISCARD constexpr const char* _Decode_utf(const char* _First, const char* _La // We want to return one past the end of a truncated sequence if everything is // otherwise valid, so we can't check if _First + _Num_bytes is off the end. _Val = 0xFFFD; - return _Last; + return {_Last, false}; } switch (_Val) { @@ -249,25 +257,25 @@ _NODISCARD constexpr const char* _Decode_utf(const char* _First, const char* _La // codepoint starts at _First + 2, this is because // we don't consume trailing bytes of ill-formed subsequences _Val = 0xFFFD; - return _First + 1; + return {_First + 1, false}; } break; case 0xED: if (static_cast(_First[1]) > 0x9F) { _Val = 0xFFFD; - return _First + 1; + return {_First + 1, false}; } break; case 0xF0: if (static_cast(_First[1]) < 0x90) { _Val = 0xFFFD; - return _First + 1; + return {_First + 1, false}; } break; case 0xF4: if (static_cast(_First[1]) > 0x8F) { _Val = 0xFFFD; - return _First + 1; + return {_First + 1, false}; } break; } @@ -293,20 +301,21 @@ _NODISCARD constexpr const char* _Decode_utf(const char* _First, const char* _La || static_cast(_First[_Idx]) > 0xBF) { // truncated sequence _Val = 0xFFFD; - return _First + _Idx; + return {_First + _Idx, false}; } // we know we're always in range due to the above check. _Val = (_Val << 6) | (static_cast(_First[_Idx]) & 0b11'1111u); } - return _First + _Num_bytes; + return {_First + _Num_bytes, true}; } -_NODISCARD constexpr const char32_t* _Decode_utf( +_NODISCARD constexpr _Decode_utf_result _Decode_utf( const char32_t* _First, const char32_t* _Last, char32_t& _Val) noexcept { _STL_INTERNAL_CHECK(_First < _Last); (void) _Last; - _Val = *_First; - return _First + 1; + _Val = *_First; + const bool _Is_usv = _Val < 0xD800 || (_Val > 0xDFFF && _Val <= 0x10FFFF); + return {_First + 1, _Is_usv}; } template @@ -323,7 +332,7 @@ public: constexpr _Unicode_codepoint_iterator(const _CharT* _First_val, const _CharT* _Last_val) noexcept : _First(_First_val), _Last(_Last_val) { - _Next = _Decode_utf(_First, _Last, _Val); + _Next = _Decode_utf(_First, _Last, _Val)._Next_ptr; } constexpr _Unicode_codepoint_iterator() = default; @@ -331,7 +340,7 @@ public: constexpr _Unicode_codepoint_iterator& operator++() noexcept { _First = _Next; if (_First != _Last) { - _Next = _Decode_utf(_First, _Last, _Val); + _Next = _Decode_utf(_First, _Last, _Val)._Next_ptr; } return *this; @@ -917,9 +926,9 @@ private: _NODISCARD static constexpr int _Utf8_code_units_in_next_character( const char* const _First, const char* const _Last) noexcept { char32_t _Ch; - const auto _Next = _Decode_utf(_First, _Last, _Ch); + const auto [_Next, _Is_usv] = _Decode_utf(_First, _Last, _Ch); _STL_INTERNAL_CHECK(_Next - _First <= 4); - return static_cast(_Next - _First); + return _Is_usv ? static_cast(_Next - _First) : -1; } public: @@ -982,9 +991,9 @@ public: _NODISCARD constexpr int _Units_in_next_character( const wchar_t* _First, const wchar_t* const _Last) const noexcept { char32_t _Ch; - const auto _Next = _Decode_utf(_First, _Last, _Ch); + const auto [_Next, _Is_usv] = _Decode_utf(_First, _Last, _Ch); _STL_INTERNAL_CHECK(_Next - _First <= 2); - return static_cast(_Next - _First); + return _Is_usv ? static_cast(_Next - _First) : -1; } }; diff --git a/stl/inc/forward_list b/stl/inc/forward_list index df9c08303fc..66aada2d043 100644 --- a/stl/inc/forward_list +++ b/stl/inc/forward_list @@ -519,6 +519,8 @@ private: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<_Ty, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("forward_list", "T")); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); using _Scary_val = _Flist_val, _Flist_simple_types<_Ty>, _Flist_iter_types<_Ty, typename _Alty_traits::size_type, typename _Alty_traits::difference_type, diff --git a/stl/inc/functional b/stl/inc/functional index f88728cca79..92390d2684f 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -12,7 +12,6 @@ #include #include #include -#include #if _HAS_CXX17 #ifdef _LEGACY_CODE_ASSUMES_FUNCTIONAL_INCLUDES_MEMORY #include @@ -31,7 +30,7 @@ _STL_DISABLE_CLANG_WARNINGS #undef new _STD_BEGIN -// plus, minus, and multiplies are defined in +// plus, minus, and multiplies are defined in _EXPORT_STD template struct divides { @@ -65,7 +64,8 @@ struct negate { } }; -// equal_to, not_equal_to, greater, less, greater_equal, and less_equal are defined in +// less is defined in +// equal_to, not_equal_to, greater, greater_equal, and less_equal are defined in _EXPORT_STD template struct logical_and { @@ -142,7 +142,7 @@ struct bit_not { } }; -// void specializations of plus, minus, and multiplies are defined in +// void specializations of plus, minus, and multiplies are defined in template <> struct divides { @@ -175,8 +175,8 @@ struct negate { using is_transparent = int; }; - -// void specializations of equal_to, not_equal_to, greater, less, greater_equal, and less_equal are defined in +// void specialization of less is defined in +// void specializations of equal_to, not_equal_to, greater, greater_equal, and less_equal are defined in template <> struct logical_and { @@ -301,6 +301,19 @@ _STL_RESTORE_DEPRECATED_WARNING #endif // _HAS_DEPRECATED_NEGATORS #if _HAS_AUTO_PTR_ETC +_EXPORT_STD template +struct unary_function { // base class for unary functions + using argument_type = _Arg; + using result_type = _Result; +}; + +_EXPORT_STD template +struct binary_function { // base class for binary functions + using first_argument_type = _Arg1; + using second_argument_type = _Arg2; + using result_type = _Result; +}; + _STL_DISABLE_DEPRECATED_WARNING _EXPORT_STD template class binder1st : public unary_function #include #include -#include +#include #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) diff --git a/stl/inc/limits b/stl/inc/limits index 45a3d0e4ab1..cd4bbf056f9 100644 --- a/stl/inc/limits +++ b/stl/inc/limits @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include _STL_INTRIN_HEADER diff --git a/stl/inc/list b/stl/inc/list index 3671b51be47..0df30ff122d 100644 --- a/stl/inc/list +++ b/stl/inc/list @@ -776,6 +776,8 @@ private: public: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<_Ty, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("list", "T")); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); using value_type = _Ty; using allocator_type = _Alloc; diff --git a/stl/inc/map b/stl/inc/map index 63bbefdb827..eaca60e2932 100644 --- a/stl/inc/map +++ b/stl/inc/map @@ -75,6 +75,10 @@ class map : public _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, false>> { public: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("map", "pair")); + static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); using _Mybase = _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, false>>; using _Nodeptr = typename _Mybase::_Nodeptr; @@ -457,6 +461,10 @@ class multimap : public _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, true>> { public: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("multimap", "pair")); + static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); using _Mybase = _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, true>>; using key_type = _Kty; diff --git a/stl/inc/memory b/stl/inc/memory index 9ba2b098c14..658f3e78cdc 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -1883,7 +1883,12 @@ _NODISCARD bool operator==(const shared_ptr<_Ty1>& _Left, const shared_ptr<_Ty2> #if _HAS_CXX20 _EXPORT_STD template _NODISCARD strong_ordering operator<=>(const shared_ptr<_Ty1>& _Left, const shared_ptr<_Ty2>& _Right) noexcept { +#if !defined(__EDG__) && !defined(__clang__) // TRANSITION, DevCom-10334808 + using _Common_ptr_t = decltype(false ? _Left.get() : _Right.get()); + return static_cast<_Common_ptr_t>(_Left.get()) <=> static_cast<_Common_ptr_t>(_Right.get()); +#else // ^^^ workaround / no workaround vvv return _Left.get() <=> _Right.get(); +#endif // ^^^ no workaround ^^^ } #else // ^^^ _HAS_CXX20 / !_HAS_CXX20 vvv template diff --git a/stl/inc/numbers b/stl/inc/numbers index af5d9e4cec3..783399e52c4 100644 --- a/stl/inc/numbers +++ b/stl/inc/numbers @@ -14,7 +14,7 @@ _EMIT_STL_WARNING(STL4038, "The contents of are available only with C+ #ifdef __cpp_lib_concepts #include #else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv -#include +#include #endif // ^^^ !defined(__cpp_lib_concepts) ^^^ #pragma pack(push, _CRT_PACKING) @@ -26,10 +26,11 @@ _STL_DISABLE_CLANG_WARNINGS _STD_BEGIN namespace numbers { +#ifdef __cpp_lib_concepts template struct _Invalid { static_assert(_Always_false<_Ty>, "A program that instantiates a primary template of a mathematical constant " - "variable template is ill-formed. (N4835 [math.constants]/3)"); + "variable template is ill-formed. (N4944 [math.constants]/3)"); }; _EXPORT_STD template @@ -59,7 +60,6 @@ namespace numbers { _EXPORT_STD template inline constexpr _Ty phi_v = _Invalid<_Ty>{}; -#ifdef __cpp_lib_concepts template inline constexpr _Floating e_v<_Floating> = static_cast<_Floating>(2.718281828459045); template @@ -87,86 +87,42 @@ namespace numbers { template inline constexpr _Floating phi_v<_Floating> = static_cast<_Floating>(1.618033988749895); #else // ^^^ defined(__cpp_lib_concepts) / !defined(__cpp_lib_concepts) vvv - template <> - inline constexpr double e_v = 2.718281828459045; - template <> - inline constexpr double log2e_v = 1.4426950408889634; - template <> - inline constexpr double log10e_v = 0.4342944819032518; - template <> - inline constexpr double pi_v = 3.141592653589793; - template <> - inline constexpr double inv_pi_v = 0.3183098861837907; - template <> - inline constexpr double inv_sqrtpi_v = 0.5641895835477563; - template <> - inline constexpr double ln2_v = 0.6931471805599453; - template <> - inline constexpr double ln10_v = 2.302585092994046; - template <> - inline constexpr double sqrt2_v = 1.4142135623730951; - template <> - inline constexpr double sqrt3_v = 1.7320508075688772; - template <> - inline constexpr double inv_sqrt3_v = 0.5773502691896257; - template <> - inline constexpr double egamma_v = 0.5772156649015329; - template <> - inline constexpr double phi_v = 1.618033988749895; + template + struct _Reject_invalid { + static_assert(is_floating_point_v<_Ty>, "A program that instantiates a primary template of a mathematical " + "constant variable template is ill-formed. (N4944 [math.constants]/3)"); + using type = _Ty; + }; - template <> - inline constexpr float e_v = static_cast(e_v); - template <> - inline constexpr float log2e_v = static_cast(log2e_v); - template <> - inline constexpr float log10e_v = static_cast(log10e_v); - template <> - inline constexpr float pi_v = static_cast(pi_v); - template <> - inline constexpr float inv_pi_v = static_cast(inv_pi_v); - template <> - inline constexpr float inv_sqrtpi_v = static_cast(inv_sqrtpi_v); - template <> - inline constexpr float ln2_v = static_cast(ln2_v); - template <> - inline constexpr float ln10_v = static_cast(ln10_v); - template <> - inline constexpr float sqrt2_v = static_cast(sqrt2_v); - template <> - inline constexpr float sqrt3_v = static_cast(sqrt3_v); - template <> - inline constexpr float inv_sqrt3_v = static_cast(inv_sqrt3_v); - template <> - inline constexpr float egamma_v = static_cast(egamma_v); - template <> - inline constexpr float phi_v = static_cast(phi_v); + template + using _Reject_invalid_t = typename _Reject_invalid<_Ty>::type; - template <> - inline constexpr long double e_v = e_v; - template <> - inline constexpr long double log2e_v = log2e_v; - template <> - inline constexpr long double log10e_v = log10e_v; - template <> - inline constexpr long double pi_v = pi_v; - template <> - inline constexpr long double inv_pi_v = inv_pi_v; - template <> - inline constexpr long double inv_sqrtpi_v = inv_sqrtpi_v; - template <> - inline constexpr long double ln2_v = ln2_v; - template <> - inline constexpr long double ln10_v = ln10_v; - template <> - inline constexpr long double sqrt2_v = sqrt2_v; - template <> - inline constexpr long double sqrt3_v = sqrt3_v; - template <> - inline constexpr long double inv_sqrt3_v = inv_sqrt3_v; - template <> - inline constexpr long double egamma_v = egamma_v; - template <> - inline constexpr long double phi_v = phi_v; + _EXPORT_STD template + inline constexpr _Ty e_v = static_cast<_Reject_invalid_t<_Ty>>(2.718281828459045); + _EXPORT_STD template + inline constexpr _Ty log2e_v = static_cast<_Reject_invalid_t<_Ty>>(1.4426950408889634); + _EXPORT_STD template + inline constexpr _Ty log10e_v = static_cast<_Reject_invalid_t<_Ty>>(0.4342944819032518); + _EXPORT_STD template + inline constexpr _Ty pi_v = static_cast<_Reject_invalid_t<_Ty>>(3.141592653589793); + _EXPORT_STD template + inline constexpr _Ty inv_pi_v = static_cast<_Reject_invalid_t<_Ty>>(0.3183098861837907); + _EXPORT_STD template + inline constexpr _Ty inv_sqrtpi_v = static_cast<_Reject_invalid_t<_Ty>>(0.5641895835477563); + _EXPORT_STD template + inline constexpr _Ty ln2_v = static_cast<_Reject_invalid_t<_Ty>>(0.6931471805599453); + _EXPORT_STD template + inline constexpr _Ty ln10_v = static_cast<_Reject_invalid_t<_Ty>>(2.302585092994046); + _EXPORT_STD template + inline constexpr _Ty sqrt2_v = static_cast<_Reject_invalid_t<_Ty>>(1.4142135623730951); + _EXPORT_STD template + inline constexpr _Ty sqrt3_v = static_cast<_Reject_invalid_t<_Ty>>(1.7320508075688772); + _EXPORT_STD template + inline constexpr _Ty inv_sqrt3_v = static_cast<_Reject_invalid_t<_Ty>>(0.5773502691896257); + _EXPORT_STD template + inline constexpr _Ty egamma_v = static_cast<_Reject_invalid_t<_Ty>>(0.5772156649015329); + _EXPORT_STD template + inline constexpr _Ty phi_v = static_cast<_Reject_invalid_t<_Ty>>(1.618033988749895); #endif // ^^^ !defined(__cpp_lib_concepts) ^^^ _EXPORT_STD inline constexpr double e = e_v; diff --git a/stl/inc/queue b/stl/inc/queue index f3b68ee2c06..68d7ec4ab1f 100644 --- a/stl/inc/queue +++ b/stl/inc/queue @@ -34,6 +34,8 @@ public: using container_type = _Container; static_assert(is_same_v<_Ty, value_type>, "container adaptors require consistent types"); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids container adaptors of non-object types " + "because of [container.requirements]."); queue() = default; @@ -234,6 +236,8 @@ public: using value_compare = _Pr; static_assert(is_same_v<_Ty, value_type>, "container adaptors require consistent types"); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids container adaptors of non-object types " + "because of [container.requirements]."); priority_queue() = default; diff --git a/stl/inc/ranges b/stl/inc/ranges index e3499c2189e..0d54666d9b3 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -9254,7 +9254,7 @@ namespace ranges { is_nothrow_move_constructible_v<_Inner_iterator<_Const>>) // strengthened : _Parent(_STD addressof(_Parent_)), _Inner(_STD move(_Inner_)) {} - _NODISCARD static _CONSTEVAL auto _Get_iterator_category() noexcept { + _NODISCARD static consteval auto _Get_iterator_category() noexcept { if constexpr (!is_reference_v<_Invoke_result_with_repeated_type<_Maybe_const<_Const, _Fn>&, range_reference_t<_Base>, _Nx>>) { return input_iterator_tag{}; @@ -9274,7 +9274,7 @@ namespace ranges { } template - _NODISCARD static _CONSTEVAL bool _Is_indirection_nothrow(index_sequence<_Indices...>) noexcept { + _NODISCARD static consteval bool _Is_indirection_nothrow(index_sequence<_Indices...>) noexcept { return noexcept(_STD invoke(_STD declval<_Maybe_const<_Const, _Fn>&>(), *_STD get<_Indices>(_STD declval&>()._Current)...)); } @@ -9712,7 +9712,7 @@ namespace ranges { inline constexpr auto _Compile_time_max_size> = _Compile_time_max_size; template - _NODISCARD _CONSTEVAL int _Cartesian_product_max_size_bit_width() noexcept { + _NODISCARD consteval int _Cartesian_product_max_size_bit_width() noexcept { if constexpr (sized_range<_Rng>) { if constexpr (requires(range_size_t<_Rng> _Val) { _STD bit_width(_Val); }) { return _STD bit_width(_Compile_time_max_size<_Rng>); @@ -9725,7 +9725,7 @@ namespace ranges { } template - _NODISCARD _CONSTEVAL auto _Cartesian_product_optimal_size_type() noexcept { + _NODISCARD consteval auto _Cartesian_product_optimal_size_type() noexcept { constexpr int _Optimal_size_type_bit_width = (_Cartesian_product_max_size_bit_width<_First>() + ... + _Cartesian_product_max_size_bit_width<_Rest>()); if constexpr (_Optimal_size_type_bit_width <= 8) { @@ -9876,7 +9876,7 @@ namespace ranges { } template - _NODISCARD static _CONSTEVAL bool _Is_iter_move_nothrow(index_sequence<_Indices...>) noexcept { + _NODISCARD static consteval bool _Is_iter_move_nothrow(index_sequence<_Indices...>) noexcept { return conjunction_v< is_nothrow_move_constructible>>, is_nothrow_move_constructible>>...> @@ -9885,7 +9885,7 @@ namespace ranges { } template - _NODISCARD static _CONSTEVAL bool _Is_iter_swap_nothrow(index_sequence<_Indices...>) noexcept { + _NODISCARD static consteval bool _Is_iter_swap_nothrow(index_sequence<_Indices...>) noexcept { return (noexcept(_RANGES iter_swap(_STD get<_Indices>(_STD declval()._Current), _STD get<_Indices>(_STD declval()._Current))) && ...); diff --git a/stl/inc/set b/stl/inc/set index 666069e89fe..f0fb28b05f6 100644 --- a/stl/inc/set +++ b/stl/inc/set @@ -54,6 +54,8 @@ class set : public _Tree<_Tset_traits<_Kty, _Pr, _Alloc, false>> { public: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<_Kty, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("set", "T")); + static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); using _Mybase = _Tree<_Tset_traits<_Kty, _Pr, _Alloc, false>>; using key_type = _Kty; @@ -265,6 +267,8 @@ class multiset : public _Tree<_Tset_traits<_Kty, _Pr, _Alloc, true>> { public: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<_Kty, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("multiset", "T")); + static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); using _Mybase = _Tree<_Tset_traits<_Kty, _Pr, _Alloc, true>>; using key_type = _Kty; diff --git a/stl/inc/stack b/stl/inc/stack index 6e8a178ac74..d23c4305a56 100644 --- a/stl/inc/stack +++ b/stl/inc/stack @@ -32,6 +32,8 @@ public: using container_type = _Container; static_assert(is_same_v<_Ty, value_type>, "container adaptors require consistent types"); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids container adaptors of non-object types " + "because of [container.requirements]."); stack() = default; diff --git a/stl/inc/system_error b/stl/inc/system_error index 04e227fc531..42b2ab7090c 100644 --- a/stl/inc/system_error +++ b/stl/inc/system_error @@ -473,6 +473,8 @@ private: } protected: + _System_error(error_code _Errcode) : runtime_error(_Errcode.message()), _Mycode(_Errcode) {} + _System_error(error_code _Errcode, const string& _Message) : runtime_error(_Makestr(_Errcode, _Message)), _Mycode(_Errcode) {} @@ -484,13 +486,13 @@ private: using _Mybase = _System_error; public: - system_error(error_code _Errcode) : _Mybase(_Errcode, "") {} + system_error(error_code _Errcode) : _Mybase(_Errcode) {} system_error(error_code _Errcode, const string& _Message) : _Mybase(_Errcode, _Message) {} system_error(error_code _Errcode, const char* _Message) : _Mybase(_Errcode, _Message) {} - system_error(int _Errval, const error_category& _Errcat) : _Mybase(error_code(_Errval, _Errcat), "") {} + system_error(int _Errval, const error_category& _Errcat) : _Mybase(error_code(_Errval, _Errcat)) {} system_error(int _Errval, const error_category& _Errcat, const string& _Message) : _Mybase(error_code(_Errval, _Errcat), _Message) {} diff --git a/stl/inc/tuple b/stl/inc/tuple index 12efb5fb710..e1aaacbd28d 100644 --- a/stl/inc/tuple +++ b/stl/inc/tuple @@ -289,9 +289,6 @@ public: #if _HAS_CXX23 && defined(__cpp_lib_concepts) template <_Tuple_like _Other> -#ifndef __clang__ // TRANSITION, DevCom-10265322 - requires _Different_from<_Other, tuple> -#endif // __clang__ _NODISCARD_FRIEND constexpr bool operator==(const tuple&, const _Other&) noexcept /* strengthened */ { static_assert(tuple_size_v<_Other> == 0, "Cannot compare tuples of different sizes (N4928 [tuple.rel]/2)."); return true; @@ -299,9 +296,6 @@ public: template <_Tuple_like _Other> requires (tuple_size_v> == 0) -#ifndef __clang__ // TRANSITION, DevCom-10265322 - && _Different_from<_Other, tuple> -#endif // __clang__ _NODISCARD_FRIEND constexpr strong_ordering operator<=>(const tuple&, const _Other&) noexcept /* strengthened */ { return strong_ordering::equal; } @@ -794,9 +788,6 @@ public: } template <_Tuple_like _Other> -#ifndef __clang__ // TRANSITION, DevCom-10265322 - requires _Different_from<_Other, tuple> -#endif // __clang__ _NODISCARD_FRIEND constexpr bool operator==(const tuple& _Left, const _Other& _Right) { static_assert(1 + sizeof...(_Rest) == tuple_size_v<_Other>, "Cannot compare tuples of different sizes (N4928 [tuple.rel]/2)."); @@ -817,9 +808,6 @@ public: } template <_Tuple_like _Other> -#ifndef __clang__ // TRANSITION, DevCom-10265322 - requires _Different_from<_Other, tuple> -#endif // __clang__ _NODISCARD_FRIEND constexpr auto operator<=>(const tuple& _Left, const _Other& _Right) -> _Three_way_comparison_result_with_tuple_like_t { return _Left._Three_way_compare_with_tuple_like(_Right, make_index_sequence<1 + sizeof...(_Rest)>{}); diff --git a/stl/inc/type_traits b/stl/inc/type_traits index 749ce928c2d..c51ef667b26 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -384,6 +384,133 @@ struct is_compound : bool_constant> {}; // determine whet _EXPORT_STD template _INLINE_VAR constexpr bool is_compound_v = !is_fundamental_v<_Ty>; +#define _EMIT_CDECL(FUNC, OPT1, OPT2, OPT3) FUNC(__cdecl, OPT1, OPT2, OPT3) + +#ifdef _M_CEE +#define _EMIT_CLRCALL(FUNC, OPT1, OPT2, OPT3) FUNC(__clrcall, OPT1, OPT2, OPT3) + +#else // _M_CEE +#define _EMIT_CLRCALL(FUNC, OPT1, OPT2, OPT3) +#endif // _M_CEE + +#if defined(_M_IX86) && !defined(_M_CEE) +#define _EMIT_FASTCALL(FUNC, OPT1, OPT2, OPT3) FUNC(__fastcall, OPT1, OPT2, OPT3) + +#else // defined(_M_IX86) && !defined(_M_CEE) +#define _EMIT_FASTCALL(FUNC, OPT1, OPT2, OPT3) +#endif // defined(_M_IX86) && !defined(_M_CEE) + +#ifdef _M_IX86 +#define _EMIT_STDCALL(FUNC, OPT1, OPT2, OPT3) FUNC(__stdcall, OPT1, OPT2, OPT3) +#define _EMIT_THISCALL(FUNC, OPT1, OPT2, OPT3) FUNC(__thiscall, OPT1, OPT2, OPT3) + +#else // _M_IX86 +#define _EMIT_STDCALL(FUNC, OPT1, OPT2, OPT3) +#define _EMIT_THISCALL(FUNC, OPT1, OPT2, OPT3) +#endif // _M_IX86 + +#if ((defined(_M_IX86) && _M_IX86_FP >= 2) || defined(_M_X64)) && !defined(_M_CEE) +#define _EMIT_VECTORCALL(FUNC, OPT1, OPT2, OPT3) FUNC(__vectorcall, OPT1, OPT2, OPT3) + +#else // defined(_M_IX86) && _M_IX86_FP >= 2 etc. +#define _EMIT_VECTORCALL(FUNC, OPT1, OPT2, OPT3) +#endif // defined(_M_IX86) && _M_IX86_FP >= 2 etc. + +#define _NON_MEMBER_CALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_CDECL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_CLRCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_FASTCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_STDCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_VECTORCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) + +#define _NON_MEMBER_CALL_CV(FUNC, REF_OPT, NOEXCEPT_OPT) \ + _NON_MEMBER_CALL(FUNC, , REF_OPT, NOEXCEPT_OPT) \ + _NON_MEMBER_CALL(FUNC, const, REF_OPT, NOEXCEPT_OPT) \ + _NON_MEMBER_CALL(FUNC, volatile, REF_OPT, NOEXCEPT_OPT) \ + _NON_MEMBER_CALL(FUNC, const volatile, REF_OPT, NOEXCEPT_OPT) + +#define _NON_MEMBER_CALL_CV_REF(FUNC, NOEXCEPT_OPT) \ + _NON_MEMBER_CALL_CV(FUNC, , NOEXCEPT_OPT) \ + _NON_MEMBER_CALL_CV(FUNC, &, NOEXCEPT_OPT) \ + _NON_MEMBER_CALL_CV(FUNC, &&, NOEXCEPT_OPT) + +#ifdef __cpp_noexcept_function_type +#define _NON_MEMBER_CALL_CV_REF_NOEXCEPT(FUNC) \ + _NON_MEMBER_CALL_CV_REF(FUNC, ) \ + _NON_MEMBER_CALL_CV_REF(FUNC, noexcept) +#else // __cpp_noexcept_function_type +#define _NON_MEMBER_CALL_CV_REF_NOEXCEPT(FUNC) _NON_MEMBER_CALL_CV_REF(FUNC, ) +#endif // __cpp_noexcept_function_type + +#define _MEMBER_CALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_CDECL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_CLRCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_FASTCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_STDCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_THISCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ + _EMIT_VECTORCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) + +#define _MEMBER_CALL_CV(FUNC, REF_OPT, NOEXCEPT_OPT) \ + _MEMBER_CALL(FUNC, , REF_OPT, NOEXCEPT_OPT) \ + _MEMBER_CALL(FUNC, const, REF_OPT, NOEXCEPT_OPT) \ + _MEMBER_CALL(FUNC, volatile, REF_OPT, NOEXCEPT_OPT) \ + _MEMBER_CALL(FUNC, const volatile, REF_OPT, NOEXCEPT_OPT) + +#define _MEMBER_CALL_CV_REF(FUNC, NOEXCEPT_OPT) \ + _MEMBER_CALL_CV(FUNC, , NOEXCEPT_OPT) \ + _MEMBER_CALL_CV(FUNC, &, NOEXCEPT_OPT) \ + _MEMBER_CALL_CV(FUNC, &&, NOEXCEPT_OPT) + +#ifdef __cpp_noexcept_function_type +#define _MEMBER_CALL_CV_REF_NOEXCEPT(FUNC) \ + _MEMBER_CALL_CV_REF(FUNC, ) \ + _MEMBER_CALL_CV_REF(FUNC, noexcept) +#else // __cpp_noexcept_function_type +#define _MEMBER_CALL_CV_REF_NOEXCEPT(FUNC) _MEMBER_CALL_CV_REF(FUNC, ) +#endif // __cpp_noexcept_function_type + +#ifdef __cpp_noexcept_function_type +#define _CLASS_DEFINE_CV_REF_NOEXCEPT(CLASS) \ + CLASS(_EMPTY_ARGUMENT) \ + CLASS(const) \ + CLASS(volatile) \ + CLASS(const volatile) \ + CLASS(&) \ + CLASS(const&) \ + CLASS(volatile&) \ + CLASS(const volatile&) \ + CLASS(&&) \ + CLASS(const&&) \ + CLASS(volatile&&) \ + CLASS(const volatile&&) \ + CLASS(noexcept) \ + CLASS(const noexcept) \ + CLASS(volatile noexcept) \ + CLASS(const volatile noexcept) \ + CLASS(&noexcept) \ + CLASS(const& noexcept) \ + CLASS(volatile& noexcept) \ + CLASS(const volatile& noexcept) \ + CLASS(&&noexcept) \ + CLASS(const&& noexcept) \ + CLASS(volatile&& noexcept) \ + CLASS(const volatile&& noexcept) +#else // __cpp_noexcept_function_type +#define _CLASS_DEFINE_CV_REF_NOEXCEPT(CLASS) \ + CLASS(_EMPTY_ARGUMENT) \ + CLASS(const) \ + CLASS(volatile) \ + CLASS(const volatile) \ + CLASS(&) \ + CLASS(const&) \ + CLASS(volatile&) \ + CLASS(const volatile&) \ + CLASS(&&) \ + CLASS(const&&) \ + CLASS(volatile&&) \ + CLASS(const volatile&&) +#endif // __cpp_noexcept_function_type + template struct _Arg_types {}; // provide argument_type, etc. when sizeof...(_Types) is 1 or 2 @@ -1471,6 +1598,36 @@ _NODISCARD _MSVC_INTRINSIC constexpr // return _STD move(_Arg); } +_EXPORT_STD template +_NODISCARD constexpr _Ty* addressof(_Ty& _Val) noexcept { + return __builtin_addressof(_Val); +} + +_EXPORT_STD template +const _Ty* addressof(const _Ty&&) = delete; + +#pragma warning(push) +#pragma warning(disable : 5215) // '%s' a function parameter with a volatile qualified type is deprecated in C++20 +#pragma warning(disable : 5216) // '%s' a volatile qualified return type is deprecated in C++20 + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-volatile" +#endif // __clang__ + +template +_NODISCARD _Ty _Fake_copy_init(_Ty) noexcept; +// _Fake_copy_init(E): +// (1) has type T [decay_t if T is deduced], +// (2) is well-formed if and only if E is implicitly convertible to T and T is destructible, and +// (3) is non-throwing if and only if both conversion from decltype((E)) to T and destruction of T are non-throwing. + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif // __clang__ + +#pragma warning(pop) + _EXPORT_STD template class reference_wrapper; @@ -2294,6 +2451,30 @@ template struct _Is_nothrow_hashable<_Kty, void_t{}(_STD declval()))>> : bool_constant{}(_STD declval()))> {}; +_EXPORT_STD template +struct less { + using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; + + _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const + noexcept(noexcept(_Fake_copy_init(_Left < _Right))) /* strengthened */ { + return _Left < _Right; + } +}; + +template <> +struct less { + template + _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const + noexcept(noexcept(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right))) // strengthened + -> decltype(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right)) { + return static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right); + } + + using is_transparent = int; +}; + // vvvvvvvvvv DERIVED FROM corecrt_internal_fltintrn.h vvvvvvvvvv template diff --git a/stl/inc/unordered_map b/stl/inc/unordered_map index dfc37c0068d..40561f6eb79 100644 --- a/stl/inc/unordered_map +++ b/stl/inc/unordered_map @@ -69,6 +69,10 @@ class unordered_map : public _Hash<_Umap_traits<_Kty, _Ty, _Uhash_compare<_Kty, public: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("unordered_map", "pair")); + static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); private: using _Mytraits = _Uhash_compare<_Kty, _Hasher, _Keyeq>; @@ -557,6 +561,10 @@ public: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE( "unordered_multimap", "pair")); + static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); private: using _Mytraits = _Uhash_compare<_Kty, _Hasher, _Keyeq>; diff --git a/stl/inc/unordered_set b/stl/inc/unordered_set index 02ffe73f50a..0401a5a4628 100644 --- a/stl/inc/unordered_set +++ b/stl/inc/unordered_set @@ -66,6 +66,8 @@ class unordered_set : public _Hash<_Uset_traits<_Kty, _Uhash_compare<_Kty, _Hash public: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<_Kty, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("unordered_set", "T")); + static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); private: using _Mytraits = _Uhash_compare<_Kty, _Hasher, _Keyeq>; @@ -411,6 +413,8 @@ class unordered_multiset : public _Hash<_Uset_traits<_Kty, _Uhash_compare<_Kty, public: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<_Kty, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("unordered_multiset", "T")); + static_assert(is_object_v<_Kty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); private: using _Mytraits = _Uhash_compare<_Kty, _Hasher, _Keyeq>; diff --git a/stl/inc/utility b/stl/inc/utility index 7bd0866585c..d16740f2c73 100644 --- a/stl/inc/utility +++ b/stl/inc/utility @@ -8,8 +8,8 @@ #define _UTILITY_ #include #if _STL_COMPILER_PREPROCESSOR +#include #include -#include #ifdef __cpp_lib_concepts #include @@ -19,6 +19,10 @@ #include #endif // _HAS_CXX20 +#if _HAS_CXX23 +#include +#endif // _HAS_CXX23 + #pragma pack(push, _CRT_PACKING) #pragma warning(push, _STL_WARNING_LEVEL) #pragma warning(disable : _STL_DISABLED_WARNINGS) diff --git a/stl/inc/vector b/stl/inc/vector index dee6fb99578..1d8ec8a59d6 100644 --- a/stl/inc/vector +++ b/stl/inc/vector @@ -447,6 +447,8 @@ private: public: static_assert(!_ENFORCE_MATCHING_ALLOCATORS || is_same_v<_Ty, typename _Alloc::value_type>, _MISMATCHED_ALLOCATOR_MESSAGE("vector", "T")); + static_assert(is_object_v<_Ty>, "The C++ Standard forbids containers of non-object types " + "because of [container.requirements]."); using value_type = _Ty; using allocator_type = _Alloc; diff --git a/stl/inc/xatomic.h b/stl/inc/xatomic.h index 83ca9def6f8..aceaadf8209 100644 --- a/stl/inc/xatomic.h +++ b/stl/inc/xatomic.h @@ -101,7 +101,7 @@ enum memory_order { }; #endif // _HAS_CXX20 -_EXPORT_STD /* TRANSITION, VSO-1592329 */ using _Atomic_counter_t = unsigned long; +using _Atomic_counter_t = unsigned long; template _NODISCARD volatile _Integral* _Atomic_address_as(_Ty& _Source) noexcept { diff --git a/stl/inc/xfilesystem_abi.h b/stl/inc/xfilesystem_abi.h index 97434fe4f88..574cb1002cf 100644 --- a/stl/inc/xfilesystem_abi.h +++ b/stl/inc/xfilesystem_abi.h @@ -79,11 +79,7 @@ enum class __std_fs_file_attr : unsigned long { }; _END_EXTERN_C -#if 1 // TRANSITION, DevCom-10247495 -_BITMASK_OPS(_EXPORT_STD, __std_fs_file_attr) -#else // ^^^ workaround / no workaround vvv _BITMASK_OPS(_EMPTY_ARGUMENT, __std_fs_file_attr) -#endif // ^^^ no workaround ^^^ _EXTERN_C enum class __std_fs_reparse_tag : unsigned long { diff --git a/stl/inc/xlocinfo b/stl/inc/xlocinfo index 8396fe52b50..746407ce2a7 100644 --- a/stl/inc/xlocinfo +++ b/stl/inc/xlocinfo @@ -14,7 +14,6 @@ #include // TRANSITION, VSO-661721 #include #include -#include #include #pragma pack(push, _CRT_PACKING) diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 6f2a28fb780..d527dd705c8 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -27,6 +27,16 @@ _STL_DISABLE_CLANG_WARNINGS #undef new _STD_BEGIN +template +_NODISCARD constexpr auto _Unfancy(_Ptrty _Ptr) noexcept { // converts from a fancy pointer to a plain pointer + return _STD addressof(*_Ptr); +} + +template +_NODISCARD constexpr _Ty* _Unfancy(_Ty* _Ptr) noexcept { // do nothing for plain pointers + return _Ptr; +} + template struct _NODISCARD _Tidy_guard { // class with destructor that calls _Tidy _Ty* _Target; @@ -907,6 +917,10 @@ class allocator { public: static_assert(!is_const_v<_Ty>, "The C++ Standard forbids containers of const elements " "because allocator is ill-formed."); + static_assert(!is_function_v<_Ty>, "The C++ Standard forbids allocators for function elements " + "because of [allocator.requirements]."); + static_assert(!is_reference_v<_Ty>, "The C++ Standard forbids allocators for reference elements " + "because of [allocator.requirements]."); using _From_primary = allocator; diff --git a/stl/inc/xstddef b/stl/inc/xstddef index 12ef3fb7126..ffa37dfcc08 100644 --- a/stl/inc/xstddef +++ b/stl/inc/xstddef @@ -9,8 +9,6 @@ #include #if _STL_COMPILER_PREPROCESSOR #include -#include -#include #include #pragma pack(push, _CRT_PACKING) @@ -22,406 +20,10 @@ _STL_DISABLE_CLANG_WARNINGS _STD_BEGIN template -// false value attached to a dependent name (for static_assert) +// TRANSITION, CWG-2518: false value attached to a dependent name (for static_assert) _INLINE_VAR constexpr bool _Always_false = false; - -// stuff from -#if _HAS_AUTO_PTR_ETC -_EXPORT_STD template -struct unary_function { // base class for unary functions - using argument_type = _Arg; - using result_type = _Result; -}; - -_EXPORT_STD template -struct binary_function { // base class for binary functions - using first_argument_type = _Arg1; - using second_argument_type = _Arg2; - using result_type = _Result; -}; -#endif // _HAS_AUTO_PTR_ETC - -#pragma warning(push) -#pragma warning(disable : 5215) // '%s' a function parameter with a volatile qualified type is deprecated in C++20 -#pragma warning(disable : 5216) // '%s' a volatile qualified return type is deprecated in C++20 - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-volatile" -#endif // __clang__ - -template -_NODISCARD _Ty _Fake_copy_init(_Ty) noexcept; -// _Fake_copy_init(E): -// (1) has type T [decay_t if T is deduced], -// (2) is well-formed if and only if E is implicitly convertible to T and T is destructible, and -// (3) is non-throwing if and only if both conversion from decltype((E)) to T and destruction of T are non-throwing. - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif // __clang__ - -#pragma warning(pop) - -_EXPORT_STD template -struct plus { - using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - - _NODISCARD constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { - return _Left + _Right; - } -}; - -_EXPORT_STD template -struct minus { - using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - - _NODISCARD constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { - return _Left - _Right; - } -}; - -_EXPORT_STD template -struct multiplies { - using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - - _NODISCARD constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { - return _Left * _Right; - } -}; - -_EXPORT_STD template -struct equal_to { - using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; - - _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const - noexcept(noexcept(_Fake_copy_init(_Left == _Right))) /* strengthened */ { - return _Left == _Right; - } -}; - -_EXPORT_STD template -struct not_equal_to { - using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; - - _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const - noexcept(noexcept(_Fake_copy_init(_Left != _Right))) /* strengthened */ { - return _Left != _Right; - } -}; - -_EXPORT_STD template -struct greater { - using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; - - _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const - noexcept(noexcept(_Fake_copy_init(_Left > _Right))) /* strengthened */ { - return _Left > _Right; - } -}; - -_EXPORT_STD template -struct less { - using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; - - _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const - noexcept(noexcept(_Fake_copy_init(_Left < _Right))) /* strengthened */ { - return _Left < _Right; - } -}; - -_EXPORT_STD template -struct greater_equal { - using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; - - _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const - noexcept(noexcept(_Fake_copy_init(_Left >= _Right))) /* strengthened */ { - return _Left >= _Right; - } -}; - -_EXPORT_STD template -struct less_equal { - using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; - using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; - - _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const - noexcept(noexcept(_Fake_copy_init(_Left <= _Right))) /* strengthened */ { - return _Left <= _Right; - } -}; - -template <> -struct plus { - template - _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(noexcept(static_cast<_Ty1&&>(_Left) + static_cast<_Ty2&&>(_Right))) // strengthened - -> decltype(static_cast<_Ty1&&>(_Left) + static_cast<_Ty2&&>(_Right)) { - return static_cast<_Ty1&&>(_Left) + static_cast<_Ty2&&>(_Right); - } - - using is_transparent = int; -}; - -template <> -struct minus { - template - _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(noexcept(static_cast<_Ty1&&>(_Left) - static_cast<_Ty2&&>(_Right))) // strengthened - -> decltype(static_cast<_Ty1&&>(_Left) - static_cast<_Ty2&&>(_Right)) { - return static_cast<_Ty1&&>(_Left) - static_cast<_Ty2&&>(_Right); - } - - using is_transparent = int; -}; - -template <> -struct multiplies { - template - _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(noexcept(static_cast<_Ty1&&>(_Left) * static_cast<_Ty2&&>(_Right))) // strengthened - -> decltype(static_cast<_Ty1&&>(_Left) * static_cast<_Ty2&&>(_Right)) { - return static_cast<_Ty1&&>(_Left) * static_cast<_Ty2&&>(_Right); - } - - using is_transparent = int; -}; - -template <> -struct equal_to { - template - _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(noexcept(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right))) // strengthened - -> decltype(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right)) { - return static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right); - } - - using is_transparent = int; -}; - -template <> -struct not_equal_to { - template - _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(noexcept(static_cast<_Ty1&&>(_Left) != static_cast<_Ty2&&>(_Right))) // strengthened - -> decltype(static_cast<_Ty1&&>(_Left) != static_cast<_Ty2&&>(_Right)) { - return static_cast<_Ty1&&>(_Left) != static_cast<_Ty2&&>(_Right); - } - - using is_transparent = int; -}; - -template <> -struct greater { - template - _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(noexcept(static_cast<_Ty1&&>(_Left) > static_cast<_Ty2&&>(_Right))) // strengthened - -> decltype(static_cast<_Ty1&&>(_Left) > static_cast<_Ty2&&>(_Right)) { - return static_cast<_Ty1&&>(_Left) > static_cast<_Ty2&&>(_Right); - } - - using is_transparent = int; -}; - -template <> -struct less { - template - _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(noexcept(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right))) // strengthened - -> decltype(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right)) { - return static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right); - } - - using is_transparent = int; -}; - -template <> -struct greater_equal { - template - _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(noexcept(static_cast<_Ty1&&>(_Left) >= static_cast<_Ty2&&>(_Right))) // strengthened - -> decltype(static_cast<_Ty1&&>(_Left) >= static_cast<_Ty2&&>(_Right)) { - return static_cast<_Ty1&&>(_Left) >= static_cast<_Ty2&&>(_Right); - } - - using is_transparent = int; -}; - -template <> -struct less_equal { - template - _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const - noexcept(noexcept(static_cast<_Ty1&&>(_Left) <= static_cast<_Ty2&&>(_Right))) // strengthened - -> decltype(static_cast<_Ty1&&>(_Left) <= static_cast<_Ty2&&>(_Right)) { - return static_cast<_Ty1&&>(_Left) <= static_cast<_Ty2&&>(_Right); - } - - using is_transparent = int; -}; - -_EXPORT_STD template -_NODISCARD constexpr _Ty* addressof(_Ty& _Val) noexcept { - return __builtin_addressof(_Val); -} - -_EXPORT_STD template -const _Ty* addressof(const _Ty&&) = delete; - -template -_NODISCARD constexpr auto _Unfancy(_Ptrty _Ptr) noexcept { // converts from a fancy pointer to a plain pointer - return _STD addressof(*_Ptr); -} - -template -_NODISCARD constexpr _Ty* _Unfancy(_Ty* _Ptr) noexcept { // do nothing for plain pointers - return _Ptr; -} _STD_END -#define _EMIT_CDECL(FUNC, OPT1, OPT2, OPT3) FUNC(__cdecl, OPT1, OPT2, OPT3) - -#ifdef _M_CEE -#define _EMIT_CLRCALL(FUNC, OPT1, OPT2, OPT3) FUNC(__clrcall, OPT1, OPT2, OPT3) - -#else // _M_CEE -#define _EMIT_CLRCALL(FUNC, OPT1, OPT2, OPT3) -#endif // _M_CEE - -#if defined(_M_IX86) && !defined(_M_CEE) -#define _EMIT_FASTCALL(FUNC, OPT1, OPT2, OPT3) FUNC(__fastcall, OPT1, OPT2, OPT3) - -#else // defined(_M_IX86) && !defined(_M_CEE) -#define _EMIT_FASTCALL(FUNC, OPT1, OPT2, OPT3) -#endif // defined(_M_IX86) && !defined(_M_CEE) - -#ifdef _M_IX86 -#define _EMIT_STDCALL(FUNC, OPT1, OPT2, OPT3) FUNC(__stdcall, OPT1, OPT2, OPT3) -#define _EMIT_THISCALL(FUNC, OPT1, OPT2, OPT3) FUNC(__thiscall, OPT1, OPT2, OPT3) - -#else // _M_IX86 -#define _EMIT_STDCALL(FUNC, OPT1, OPT2, OPT3) -#define _EMIT_THISCALL(FUNC, OPT1, OPT2, OPT3) -#endif // _M_IX86 - -#if ((defined(_M_IX86) && _M_IX86_FP >= 2) || defined(_M_X64)) && !defined(_M_CEE) -#define _EMIT_VECTORCALL(FUNC, OPT1, OPT2, OPT3) FUNC(__vectorcall, OPT1, OPT2, OPT3) - -#else // defined(_M_IX86) && _M_IX86_FP >= 2 etc. -#define _EMIT_VECTORCALL(FUNC, OPT1, OPT2, OPT3) -#endif // defined(_M_IX86) && _M_IX86_FP >= 2 etc. - -#define _NON_MEMBER_CALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_CDECL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_CLRCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_FASTCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_STDCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_VECTORCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) - -#define _NON_MEMBER_CALL_CV(FUNC, REF_OPT, NOEXCEPT_OPT) \ - _NON_MEMBER_CALL(FUNC, , REF_OPT, NOEXCEPT_OPT) \ - _NON_MEMBER_CALL(FUNC, const, REF_OPT, NOEXCEPT_OPT) \ - _NON_MEMBER_CALL(FUNC, volatile, REF_OPT, NOEXCEPT_OPT) \ - _NON_MEMBER_CALL(FUNC, const volatile, REF_OPT, NOEXCEPT_OPT) - -#define _NON_MEMBER_CALL_CV_REF(FUNC, NOEXCEPT_OPT) \ - _NON_MEMBER_CALL_CV(FUNC, , NOEXCEPT_OPT) \ - _NON_MEMBER_CALL_CV(FUNC, &, NOEXCEPT_OPT) \ - _NON_MEMBER_CALL_CV(FUNC, &&, NOEXCEPT_OPT) - -#ifdef __cpp_noexcept_function_type -#define _NON_MEMBER_CALL_CV_REF_NOEXCEPT(FUNC) \ - _NON_MEMBER_CALL_CV_REF(FUNC, ) \ - _NON_MEMBER_CALL_CV_REF(FUNC, noexcept) -#else // __cpp_noexcept_function_type -#define _NON_MEMBER_CALL_CV_REF_NOEXCEPT(FUNC) _NON_MEMBER_CALL_CV_REF(FUNC, ) -#endif // __cpp_noexcept_function_type - -#define _MEMBER_CALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_CDECL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_CLRCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_FASTCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_STDCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_THISCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) \ - _EMIT_VECTORCALL(FUNC, CV_OPT, REF_OPT, NOEXCEPT_OPT) - -#define _MEMBER_CALL_CV(FUNC, REF_OPT, NOEXCEPT_OPT) \ - _MEMBER_CALL(FUNC, , REF_OPT, NOEXCEPT_OPT) \ - _MEMBER_CALL(FUNC, const, REF_OPT, NOEXCEPT_OPT) \ - _MEMBER_CALL(FUNC, volatile, REF_OPT, NOEXCEPT_OPT) \ - _MEMBER_CALL(FUNC, const volatile, REF_OPT, NOEXCEPT_OPT) - -#define _MEMBER_CALL_CV_REF(FUNC, NOEXCEPT_OPT) \ - _MEMBER_CALL_CV(FUNC, , NOEXCEPT_OPT) \ - _MEMBER_CALL_CV(FUNC, &, NOEXCEPT_OPT) \ - _MEMBER_CALL_CV(FUNC, &&, NOEXCEPT_OPT) - -#ifdef __cpp_noexcept_function_type -#define _MEMBER_CALL_CV_REF_NOEXCEPT(FUNC) \ - _MEMBER_CALL_CV_REF(FUNC, ) \ - _MEMBER_CALL_CV_REF(FUNC, noexcept) -#else // __cpp_noexcept_function_type -#define _MEMBER_CALL_CV_REF_NOEXCEPT(FUNC) _MEMBER_CALL_CV_REF(FUNC, ) -#endif // __cpp_noexcept_function_type - -#ifdef __cpp_noexcept_function_type -#define _CLASS_DEFINE_CV_REF_NOEXCEPT(CLASS) \ - CLASS(_EMPTY_ARGUMENT) \ - CLASS(const) \ - CLASS(volatile) \ - CLASS(const volatile) \ - CLASS(&) \ - CLASS(const&) \ - CLASS(volatile&) \ - CLASS(const volatile&) \ - CLASS(&&) \ - CLASS(const&&) \ - CLASS(volatile&&) \ - CLASS(const volatile&&) \ - CLASS(noexcept) \ - CLASS(const noexcept) \ - CLASS(volatile noexcept) \ - CLASS(const volatile noexcept) \ - CLASS(&noexcept) \ - CLASS(const& noexcept) \ - CLASS(volatile& noexcept) \ - CLASS(const volatile& noexcept) \ - CLASS(&&noexcept) \ - CLASS(const&& noexcept) \ - CLASS(volatile&& noexcept) \ - CLASS(const volatile&& noexcept) -#else // __cpp_noexcept_function_type -#define _CLASS_DEFINE_CV_REF_NOEXCEPT(CLASS) \ - CLASS(_EMPTY_ARGUMENT) \ - CLASS(const) \ - CLASS(volatile) \ - CLASS(const volatile) \ - CLASS(&) \ - CLASS(const&) \ - CLASS(volatile&) \ - CLASS(const volatile&) \ - CLASS(&&) \ - CLASS(const&&) \ - CLASS(volatile&&) \ - CLASS(const volatile&&) -#endif // __cpp_noexcept_function_type - #pragma pop_macro("new") _STL_RESTORE_CLANG_WARNINGS #pragma warning(pop) diff --git a/stl/inc/xutility b/stl/inc/xutility index 047456fe00f..9ed0ea2df90 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -345,6 +345,195 @@ _EXPORT_STD struct identity { }; #endif // _HAS_CXX20 +_EXPORT_STD template +struct plus { + using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + + _NODISCARD constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { + return _Left + _Right; + } +}; + +_EXPORT_STD template +struct minus { + using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + + _NODISCARD constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { + return _Left - _Right; + } +}; + +_EXPORT_STD template +struct multiplies { + using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + + _NODISCARD constexpr _Ty operator()(const _Ty& _Left, const _Ty& _Right) const { + return _Left * _Right; + } +}; + +_EXPORT_STD template +struct equal_to { + using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; + + _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const + noexcept(noexcept(_Fake_copy_init(_Left == _Right))) /* strengthened */ { + return _Left == _Right; + } +}; + +_EXPORT_STD template +struct not_equal_to { + using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; + + _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const + noexcept(noexcept(_Fake_copy_init(_Left != _Right))) /* strengthened */ { + return _Left != _Right; + } +}; + +_EXPORT_STD template +struct greater { + using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; + + _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const + noexcept(noexcept(_Fake_copy_init(_Left > _Right))) /* strengthened */ { + return _Left > _Right; + } +}; + +_EXPORT_STD template +struct greater_equal { + using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; + + _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const + noexcept(noexcept(_Fake_copy_init(_Left >= _Right))) /* strengthened */ { + return _Left >= _Right; + } +}; + +_EXPORT_STD template +struct less_equal { + using _FIRST_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _SECOND_ARGUMENT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = _Ty; + using _RESULT_TYPE_NAME _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS = bool; + + _NODISCARD constexpr bool operator()(const _Ty& _Left, const _Ty& _Right) const + noexcept(noexcept(_Fake_copy_init(_Left <= _Right))) /* strengthened */ { + return _Left <= _Right; + } +}; + +template <> +struct plus { + template + _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const + noexcept(noexcept(static_cast<_Ty1&&>(_Left) + static_cast<_Ty2&&>(_Right))) // strengthened + -> decltype(static_cast<_Ty1&&>(_Left) + static_cast<_Ty2&&>(_Right)) { + return static_cast<_Ty1&&>(_Left) + static_cast<_Ty2&&>(_Right); + } + + using is_transparent = int; +}; + +template <> +struct minus { + template + _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const + noexcept(noexcept(static_cast<_Ty1&&>(_Left) - static_cast<_Ty2&&>(_Right))) // strengthened + -> decltype(static_cast<_Ty1&&>(_Left) - static_cast<_Ty2&&>(_Right)) { + return static_cast<_Ty1&&>(_Left) - static_cast<_Ty2&&>(_Right); + } + + using is_transparent = int; +}; + +template <> +struct multiplies { + template + _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const + noexcept(noexcept(static_cast<_Ty1&&>(_Left) * static_cast<_Ty2&&>(_Right))) // strengthened + -> decltype(static_cast<_Ty1&&>(_Left) * static_cast<_Ty2&&>(_Right)) { + return static_cast<_Ty1&&>(_Left) * static_cast<_Ty2&&>(_Right); + } + + using is_transparent = int; +}; + +template <> +struct equal_to { + template + _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const + noexcept(noexcept(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right))) // strengthened + -> decltype(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right)) { + return static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right); + } + + using is_transparent = int; +}; + +template <> +struct not_equal_to { + template + _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const + noexcept(noexcept(static_cast<_Ty1&&>(_Left) != static_cast<_Ty2&&>(_Right))) // strengthened + -> decltype(static_cast<_Ty1&&>(_Left) != static_cast<_Ty2&&>(_Right)) { + return static_cast<_Ty1&&>(_Left) != static_cast<_Ty2&&>(_Right); + } + + using is_transparent = int; +}; + +template <> +struct greater { + template + _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const + noexcept(noexcept(static_cast<_Ty1&&>(_Left) > static_cast<_Ty2&&>(_Right))) // strengthened + -> decltype(static_cast<_Ty1&&>(_Left) > static_cast<_Ty2&&>(_Right)) { + return static_cast<_Ty1&&>(_Left) > static_cast<_Ty2&&>(_Right); + } + + using is_transparent = int; +}; + +template <> +struct greater_equal { + template + _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const + noexcept(noexcept(static_cast<_Ty1&&>(_Left) >= static_cast<_Ty2&&>(_Right))) // strengthened + -> decltype(static_cast<_Ty1&&>(_Left) >= static_cast<_Ty2&&>(_Right)) { + return static_cast<_Ty1&&>(_Left) >= static_cast<_Ty2&&>(_Right); + } + + using is_transparent = int; +}; + +template <> +struct less_equal { + template + _NODISCARD constexpr auto operator()(_Ty1&& _Left, _Ty2&& _Right) const + noexcept(noexcept(static_cast<_Ty1&&>(_Left) <= static_cast<_Ty2&&>(_Right))) // strengthened + -> decltype(static_cast<_Ty1&&>(_Left) <= static_cast<_Ty2&&>(_Right)) { + return static_cast<_Ty1&&>(_Left) <= static_cast<_Ty2&&>(_Right); + } + + using is_transparent = int; +}; + template struct _Ref_fn { // pass function object by value as a reference template diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 893f73b9d08..b1fc9a6c944 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -285,6 +285,7 @@ // P2432R1 Fix istream_view // P2508R1 basic_format_string, format_string, wformat_string // P2520R0 move_iterator Should Be A Random-Access Iterator +// P2572R1 std::format Fill Character Allowances // P2588R3 barrier's Phase Completion Guarantees // P2602R2 Poison Pills Are Too Toxic // P2609R3 Relaxing Ranges Just A Smidge @@ -828,7 +829,7 @@ #define _CPPLIB_VER 650 #define _MSVC_STL_VERSION 143 -#define _MSVC_STL_UPDATE 202303L +#define _MSVC_STL_UPDATE 202304L #ifndef _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH #if defined(__CUDACC__) && defined(__CUDACC_VER_MAJOR__) diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index a1fe83c5569..5066b3be088 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -132,6 +132,9 @@ std/strings/string.view/string.view.cons/from_range.pass.cpp FAIL std/strings/string.view/string.view.cons/from_string1.compile.fail.cpp FAIL std/strings/string.view/string.view.cons/from_string2.compile.fail.cpp FAIL +# libc++ doesn't implement LWG-3865 Sorting a range of pairs +std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp FAIL + # libc++ doesn't implement LWG-3870 std/utilities/memory/specialized.algorithms/specialized.construct/ranges_construct_at.pass.cpp FAIL std/utilities/memory/specialized.algorithms/uninitialized.construct.default/ranges_uninitialized_default_construct.pass.cpp FAIL @@ -173,9 +176,6 @@ std/ranges/range.adaptors/range.join.view/sentinel/eq.pass.cpp FAIL std/re/re.iter/re.regiter/iterator_concept_conformance.compile.pass.cpp FAIL std/re/re.iter/re.tokiter/iterator_concept_conformance.compile.pass.cpp FAIL -# libc++ doesn't implement LWG-3865 Sorting a range of pairs -std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp FAIL - # *** INTERACTIONS WITH CONTEST / C1XX THAT UPSTREAM LIKELY WON'T FIX *** # Tracked by VSO-593630 " Enable libcxx filesystem tests" @@ -338,6 +338,9 @@ std/algorithms/algorithms.results/no_unique_address.compile.pass.cpp SKIPPED # *** MISSING LWG ISSUE RESOLUTIONS *** +# LWG-2192 "Validity and return type of std::abs(0u) is unclear" (resolution is missing in UCRT, DevCom-10331466) +std/depr/depr.c.headers/stdlib_h.pass.cpp FAIL + # LWG-2503 "multiline option should be added to syntax_option_type" std/re/re.const/re.matchflag/match_multiline.pass.cpp FAIL diff --git a/tests/std/include/test_header_units_and_modules.hpp b/tests/std/include/test_header_units_and_modules.hpp index f439720a118..33fc4115a77 100644 --- a/tests/std/include/test_header_units_and_modules.hpp +++ b/tests/std/include/test_header_units_and_modules.hpp @@ -661,11 +661,7 @@ constexpr bool impl_test_source_location() { using namespace std; const auto sl = source_location::current(); assert(sl.line() == __LINE__ - 1); -#if defined(_MSVC_INTERNAL_TESTING) || _MSC_FULL_VER >= 193632502 // TRANSITION, VS 2022 17.6 Preview 2 assert(sl.column() == 38); -#else // ^^^ no workaround / workaround vvv - assert(sl.column() == 1); -#endif // ^^^ workaround ^^^ #if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-10199227 and LLVM-58951 assert(sl.function_name() == "impl_test_source_location"sv); #else // ^^^ workaround / no workaround vvv diff --git a/tests/std/tests/P0355R7_calendars_and_time_zones_formatting/test.cpp b/tests/std/tests/P0355R7_calendars_and_time_zones_formatting/test.cpp index 1b4e719d1b0..f9de6a57ea5 100644 --- a/tests/std/tests/P0355R7_calendars_and_time_zones_formatting/test.cpp +++ b/tests/std/tests/P0355R7_calendars_and_time_zones_formatting/test.cpp @@ -798,11 +798,11 @@ void test_exception_classes() { } assert(s - == "2016-11-06 01:30:00 is ambiguous. It could be\n" + == "2016-11-06 01:30:00 is ambiguous. It could be\n" "2016-11-06 01:30:00 EDT == 2016-11-06 05:30:00 UTC or\n" "2016-11-06 01:30:00 EST == 2016-11-06 06:30:00 UTC" || s - == "2016-11-06 01:30:00 is ambiguous. It could be\n" + == "2016-11-06 01:30:00 is ambiguous. It could be\n" "2016-11-06 01:30:00 GMT-4 == 2016-11-06 05:30:00 UTC or\n" "2016-11-06 01:30:00 GMT-5 == 2016-11-06 06:30:00 UTC"); } diff --git a/tests/std/tests/P0631R8_numbers_math_constants/test.cpp b/tests/std/tests/P0631R8_numbers_math_constants/test.cpp index dfd89fd3b10..fd265a012cf 100644 --- a/tests/std/tests/P0631R8_numbers_math_constants/test.cpp +++ b/tests/std/tests/P0631R8_numbers_math_constants/test.cpp @@ -1,18 +1,126 @@ // Copyright (c) Microsoft Corporation. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #include #include +#pragma warning(disable : 4197) // '%s': top-level volatile in cast is ignored + #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) -template +template [[nodiscard]] constexpr bool test_case(T& actual, const U expected) { - STATIC_ASSERT(std::is_same_v); + STATIC_ASSERT(std::is_same_v, const U>); return actual == expected; } -// N4835 [math.constants]/2: "a program may partially or explicitly specialize a mathematical constant +enum class modify_cv { + type_identity, + add_const, + add_volatile, + add_cv, +}; + +template +struct apply_modify_cv { + using type = T; +}; + +template +struct apply_modify_cv { + using type = const T; +}; + +template +struct apply_modify_cv { + using type = volatile T; +}; + +template +struct apply_modify_cv { + using type = const volatile T; +}; + +template +using apply_modify_cv_t = typename apply_modify_cv::type; + +template +constexpr void test_cv_floating_point() { + using F = apply_modify_cv_t; + using D = apply_modify_cv_t; + using L = apply_modify_cv_t; + + assert(test_case(std::numbers::e_v, 0x1.5bf0a8p+1f)); + assert(test_case(std::numbers::e_v, 0x1.5bf0a8b145769p+1)); + assert(test_case(std::numbers::e_v, 0x1.5bf0a8b145769p+1L)); + + assert(test_case(std::numbers::log2e_v, 0x1.715476p+0f)); + assert(test_case(std::numbers::log2e_v, 0x1.71547652b82fep+0)); + assert(test_case(std::numbers::log2e_v, 0x1.71547652b82fep+0L)); + + assert(test_case(std::numbers::log10e_v, 0x1.bcb7b2p-2f)); + assert(test_case(std::numbers::log10e_v, 0x1.bcb7b1526e50ep-2)); + assert(test_case(std::numbers::log10e_v, 0x1.bcb7b1526e50ep-2L)); + + assert(test_case(std::numbers::pi_v, 0x1.921fb6p+1f)); + assert(test_case(std::numbers::pi_v, 0x1.921fb54442d18p+1)); + assert(test_case(std::numbers::pi_v, 0x1.921fb54442d18p+1L)); + + assert(test_case(std::numbers::inv_pi_v, 0x1.45f306p-2f)); + assert(test_case(std::numbers::inv_pi_v, 0x1.45f306dc9c883p-2)); + assert(test_case(std::numbers::inv_pi_v, 0x1.45f306dc9c883p-2L)); + + assert(test_case(std::numbers::inv_sqrtpi_v, 0x1.20dd76p-1f)); + assert(test_case(std::numbers::inv_sqrtpi_v, 0x1.20dd750429b6dp-1)); + assert(test_case(std::numbers::inv_sqrtpi_v, 0x1.20dd750429b6dp-1L)); + + assert(test_case(std::numbers::ln2_v, 0x1.62e430p-1f)); + assert(test_case(std::numbers::ln2_v, 0x1.62e42fefa39efp-1)); + assert(test_case(std::numbers::ln2_v, 0x1.62e42fefa39efp-1L)); + + assert(test_case(std::numbers::ln10_v, 0x1.26bb1cp+1f)); + assert(test_case(std::numbers::ln10_v, 0x1.26bb1bbb55516p+1)); + assert(test_case(std::numbers::ln10_v, 0x1.26bb1bbb55516p+1L)); + + assert(test_case(std::numbers::sqrt2_v, 0x1.6a09e6p+0f)); + assert(test_case(std::numbers::sqrt2_v, 0x1.6a09e667f3bcdp+0)); + assert(test_case(std::numbers::sqrt2_v, 0x1.6a09e667f3bcdp+0L)); + + assert(test_case(std::numbers::sqrt3_v, 0x1.bb67aep+0f)); + assert(test_case(std::numbers::sqrt3_v, 0x1.bb67ae8584caap+0)); + assert(test_case(std::numbers::sqrt3_v, 0x1.bb67ae8584caap+0L)); + + assert(test_case(std::numbers::inv_sqrt3_v, 0x1.279a74p-1f)); + assert(test_case(std::numbers::inv_sqrt3_v, 0x1.279a74590331cp-1)); + assert(test_case(std::numbers::inv_sqrt3_v, 0x1.279a74590331cp-1L)); + + assert(test_case(std::numbers::egamma_v, 0x1.2788d0p-1f)); + assert(test_case(std::numbers::egamma_v, 0x1.2788cfc6fb619p-1)); + assert(test_case(std::numbers::egamma_v, 0x1.2788cfc6fb619p-1L)); + + assert(test_case(std::numbers::phi_v, 0x1.9e377ap+0f)); + assert(test_case(std::numbers::phi_v, 0x1.9e3779b97f4a8p+0)); + assert(test_case(std::numbers::phi_v, 0x1.9e3779b97f4a8p+0L)); +} + +constexpr void test_double() { + assert(test_case(std::numbers::e, 0x1.5bf0a8b145769p+1)); + assert(test_case(std::numbers::log2e, 0x1.71547652b82fep+0)); + assert(test_case(std::numbers::log10e, 0x1.bcb7b1526e50ep-2)); + assert(test_case(std::numbers::pi, 0x1.921fb54442d18p+1)); + assert(test_case(std::numbers::inv_pi, 0x1.45f306dc9c883p-2)); + assert(test_case(std::numbers::inv_sqrtpi, 0x1.20dd750429b6dp-1)); + assert(test_case(std::numbers::ln2, 0x1.62e42fefa39efp-1)); + assert(test_case(std::numbers::ln10, 0x1.26bb1bbb55516p+1)); + assert(test_case(std::numbers::sqrt2, 0x1.6a09e667f3bcdp+0)); + assert(test_case(std::numbers::sqrt3, 0x1.bb67ae8584caap+0)); + assert(test_case(std::numbers::inv_sqrt3, 0x1.279a74590331cp-1)); + assert(test_case(std::numbers::egamma, 0x1.2788cfc6fb619p-1)); + assert(test_case(std::numbers::phi, 0x1.9e3779b97f4a8p+0)); +} + +// N4944 [math.constants]/2: "a program may partially or explicitly specialize a mathematical constant // variable template provided that the specialization depends on a program-defined type." struct Meow { int val; @@ -45,87 +153,38 @@ inline constexpr Meow std::numbers::egamma_v{-120}; template <> inline constexpr Meow std::numbers::phi_v{-130}; +constexpr void test_program_defined_specialization() { + assert(test_case(std::numbers::e_v.val, -10)); + assert(test_case(std::numbers::log2e_v.val, -20)); + assert(test_case(std::numbers::log10e_v.val, -30)); + assert(test_case(std::numbers::pi_v.val, -40)); + assert(test_case(std::numbers::inv_pi_v.val, -50)); + assert(test_case(std::numbers::inv_sqrtpi_v.val, -60)); + assert(test_case(std::numbers::ln2_v.val, -70)); + assert(test_case(std::numbers::ln10_v.val, -80)); + assert(test_case(std::numbers::sqrt2_v.val, -90)); + assert(test_case(std::numbers::sqrt3_v.val, -100)); + assert(test_case(std::numbers::inv_sqrt3_v.val, -110)); + assert(test_case(std::numbers::egamma_v.val, -120)); + assert(test_case(std::numbers::phi_v.val, -130)); +} + +constexpr bool test_all() { + test_cv_floating_point(); + test_cv_floating_point(); + + if (!std::is_constant_evaluated()) { + test_cv_floating_point(); // constexpr-incompatible + test_cv_floating_point(); // constexpr-incompatible + } + + test_double(); + test_program_defined_specialization(); + + return true; +} + int main() { - STATIC_ASSERT(test_case(std::numbers::e_v.val, -10)); - STATIC_ASSERT(test_case(std::numbers::log2e_v.val, -20)); - STATIC_ASSERT(test_case(std::numbers::log10e_v.val, -30)); - STATIC_ASSERT(test_case(std::numbers::pi_v.val, -40)); - STATIC_ASSERT(test_case(std::numbers::inv_pi_v.val, -50)); - STATIC_ASSERT(test_case(std::numbers::inv_sqrtpi_v.val, -60)); - STATIC_ASSERT(test_case(std::numbers::ln2_v.val, -70)); - STATIC_ASSERT(test_case(std::numbers::ln10_v.val, -80)); - STATIC_ASSERT(test_case(std::numbers::sqrt2_v.val, -90)); - STATIC_ASSERT(test_case(std::numbers::sqrt3_v.val, -100)); - STATIC_ASSERT(test_case(std::numbers::inv_sqrt3_v.val, -110)); - STATIC_ASSERT(test_case(std::numbers::egamma_v.val, -120)); - STATIC_ASSERT(test_case(std::numbers::phi_v.val, -130)); - - using F = float; - using D = double; - using L = long double; - - STATIC_ASSERT(test_case(std::numbers::e_v, 0x1.5bf0a8p+1f)); - STATIC_ASSERT(test_case(std::numbers::e_v, 0x1.5bf0a8b145769p+1)); - STATIC_ASSERT(test_case(std::numbers::e_v, 0x1.5bf0a8b145769p+1L)); - STATIC_ASSERT(test_case(std::numbers::e /**/, 0x1.5bf0a8b145769p+1)); - - STATIC_ASSERT(test_case(std::numbers::log2e_v, 0x1.715476p+0f)); - STATIC_ASSERT(test_case(std::numbers::log2e_v, 0x1.71547652b82fep+0)); - STATIC_ASSERT(test_case(std::numbers::log2e_v, 0x1.71547652b82fep+0L)); - STATIC_ASSERT(test_case(std::numbers::log2e /**/, 0x1.71547652b82fep+0)); - - STATIC_ASSERT(test_case(std::numbers::log10e_v, 0x1.bcb7b2p-2f)); - STATIC_ASSERT(test_case(std::numbers::log10e_v, 0x1.bcb7b1526e50ep-2)); - STATIC_ASSERT(test_case(std::numbers::log10e_v, 0x1.bcb7b1526e50ep-2L)); - STATIC_ASSERT(test_case(std::numbers::log10e /**/, 0x1.bcb7b1526e50ep-2)); - - STATIC_ASSERT(test_case(std::numbers::pi_v, 0x1.921fb6p+1f)); - STATIC_ASSERT(test_case(std::numbers::pi_v, 0x1.921fb54442d18p+1)); - STATIC_ASSERT(test_case(std::numbers::pi_v, 0x1.921fb54442d18p+1L)); - STATIC_ASSERT(test_case(std::numbers::pi /**/, 0x1.921fb54442d18p+1)); - - STATIC_ASSERT(test_case(std::numbers::inv_pi_v, 0x1.45f306p-2f)); - STATIC_ASSERT(test_case(std::numbers::inv_pi_v, 0x1.45f306dc9c883p-2)); - STATIC_ASSERT(test_case(std::numbers::inv_pi_v, 0x1.45f306dc9c883p-2L)); - STATIC_ASSERT(test_case(std::numbers::inv_pi /**/, 0x1.45f306dc9c883p-2)); - - STATIC_ASSERT(test_case(std::numbers::inv_sqrtpi_v, 0x1.20dd76p-1f)); - STATIC_ASSERT(test_case(std::numbers::inv_sqrtpi_v, 0x1.20dd750429b6dp-1)); - STATIC_ASSERT(test_case(std::numbers::inv_sqrtpi_v, 0x1.20dd750429b6dp-1L)); - STATIC_ASSERT(test_case(std::numbers::inv_sqrtpi /**/, 0x1.20dd750429b6dp-1)); - - STATIC_ASSERT(test_case(std::numbers::ln2_v, 0x1.62e430p-1f)); - STATIC_ASSERT(test_case(std::numbers::ln2_v, 0x1.62e42fefa39efp-1)); - STATIC_ASSERT(test_case(std::numbers::ln2_v, 0x1.62e42fefa39efp-1L)); - STATIC_ASSERT(test_case(std::numbers::ln2 /**/, 0x1.62e42fefa39efp-1)); - - STATIC_ASSERT(test_case(std::numbers::ln10_v, 0x1.26bb1cp+1f)); - STATIC_ASSERT(test_case(std::numbers::ln10_v, 0x1.26bb1bbb55516p+1)); - STATIC_ASSERT(test_case(std::numbers::ln10_v, 0x1.26bb1bbb55516p+1L)); - STATIC_ASSERT(test_case(std::numbers::ln10 /**/, 0x1.26bb1bbb55516p+1)); - - STATIC_ASSERT(test_case(std::numbers::sqrt2_v, 0x1.6a09e6p+0f)); - STATIC_ASSERT(test_case(std::numbers::sqrt2_v, 0x1.6a09e667f3bcdp+0)); - STATIC_ASSERT(test_case(std::numbers::sqrt2_v, 0x1.6a09e667f3bcdp+0L)); - STATIC_ASSERT(test_case(std::numbers::sqrt2 /**/, 0x1.6a09e667f3bcdp+0)); - - STATIC_ASSERT(test_case(std::numbers::sqrt3_v, 0x1.bb67aep+0f)); - STATIC_ASSERT(test_case(std::numbers::sqrt3_v, 0x1.bb67ae8584caap+0)); - STATIC_ASSERT(test_case(std::numbers::sqrt3_v, 0x1.bb67ae8584caap+0L)); - STATIC_ASSERT(test_case(std::numbers::sqrt3 /**/, 0x1.bb67ae8584caap+0)); - - STATIC_ASSERT(test_case(std::numbers::inv_sqrt3_v, 0x1.279a74p-1f)); - STATIC_ASSERT(test_case(std::numbers::inv_sqrt3_v, 0x1.279a74590331cp-1)); - STATIC_ASSERT(test_case(std::numbers::inv_sqrt3_v, 0x1.279a74590331cp-1L)); - STATIC_ASSERT(test_case(std::numbers::inv_sqrt3 /**/, 0x1.279a74590331cp-1)); - - STATIC_ASSERT(test_case(std::numbers::egamma_v, 0x1.2788d0p-1f)); - STATIC_ASSERT(test_case(std::numbers::egamma_v, 0x1.2788cfc6fb619p-1)); - STATIC_ASSERT(test_case(std::numbers::egamma_v, 0x1.2788cfc6fb619p-1L)); - STATIC_ASSERT(test_case(std::numbers::egamma /**/, 0x1.2788cfc6fb619p-1)); - - STATIC_ASSERT(test_case(std::numbers::phi_v, 0x1.9e377ap+0f)); - STATIC_ASSERT(test_case(std::numbers::phi_v, 0x1.9e3779b97f4a8p+0)); - STATIC_ASSERT(test_case(std::numbers::phi_v, 0x1.9e3779b97f4a8p+0L)); - STATIC_ASSERT(test_case(std::numbers::phi /**/, 0x1.9e3779b97f4a8p+0)); + assert(test_all()); + STATIC_ASSERT(test_all()); } diff --git a/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/test.cpp b/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/test.cpp index 3c462e2937b..eac2577ce83 100644 --- a/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/test.cpp +++ b/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/test.cpp @@ -46,6 +46,8 @@ void test_parse_align() { {.expected_alignment = _Fmt_align::_Right, .expected_fill = "\x96\x7b"sv}); test_parse_helper(parse_align_fn, "\x92\x6e^X"sv, false, 3, {.expected_alignment = _Fmt_align::_Center, .expected_fill = "\x92\x6e"sv}); + + test_parse_helper(parse_align_fn, "\x92\x30 diff --git a/tests/std/tests/P0980R1_constexpr_strings/test.cpp b/tests/std/tests/P0980R1_constexpr_strings/test.cpp index 8d8cf25b2ee..d6680dc1f4e 100644 --- a/tests/std/tests/P0980R1_constexpr_strings/test.cpp +++ b/tests/std/tests/P0980R1_constexpr_strings/test.cpp @@ -608,9 +608,6 @@ constexpr bool test_interface() { assert(cleared.capacity() == str{get_literal_input()}.capacity()); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // insert str insert_char = get_literal_input(); const CharType to_be_inserted = CharType{','}; @@ -688,9 +685,6 @@ constexpr bool test_interface() { assert(equalRanges(insert_iter_count_char, "Hellooooo fluffy kittens"sv)); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // erase str erase_pos_count = get_literal_input(); erase_pos_count.erase(0, 6); @@ -967,9 +961,6 @@ constexpr bool test_interface() { } #endif // _HAS_CXX23 -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // replace const str input = get_dog(); @@ -1059,9 +1050,6 @@ constexpr bool test_interface() { assert(equalRanges(replaced_pos_count_conversion_pos_count, "dfluffy"sv)); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // substr const str input = get_literal_input(); @@ -1558,9 +1546,6 @@ constexpr bool test_interface() { assert(find_last_not_of_convertible_pos == str::npos); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // operator+ const str first = get_cat(); const str second = get_dog(); @@ -1690,12 +1675,6 @@ constexpr bool test_interface() { } constexpr bool test_udls() { -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (is_constant_evaluated()) { - return true; - } -#endif // ^^^ workaround ^^^ - assert(equalRanges("purr purr"s, "purr purr"sv)); #ifdef __cpp_char8_t assert(equalRanges(u8"purr purr"s, "purr purr"sv)); @@ -1752,9 +1731,6 @@ constexpr bool test_iterators() { assert(*cit == CharType{'l'}); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // advance auto it = literal_constructed.begin() + 2; assert(*it == CharType{'l'}); @@ -1783,9 +1759,6 @@ constexpr bool test_iterators() { assert(*cit == CharType{'n'}); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // advance back auto it = literal_constructed.end() - 2; assert(*it == CharType{'n'}); @@ -1828,9 +1801,6 @@ constexpr bool test_iterators() { assert((it3 <=> it1) == strong_ordering::greater); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // access const auto it = literal_constructed.begin() + 2; it[2] = CharType{'l'}; @@ -1886,9 +1856,6 @@ constexpr bool test_growth() { assert(v.capacity() == 1510); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { str v(1007, CharType{'a'}); @@ -1903,9 +1870,6 @@ constexpr bool test_growth() { assert(v.capacity() == 1510); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { str v(1007, CharType{'a'}); @@ -1924,9 +1888,6 @@ constexpr bool test_growth() { } } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { str v(1007, CharType{'a'}); @@ -1939,9 +1900,6 @@ constexpr bool test_growth() { assert(v.capacity() == 1510); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { str v(1007, CharType{'a'}); @@ -2059,12 +2017,6 @@ constexpr void test_copy_assign(const size_t id1, const size_t id2, const size_t template constexpr void test_move_ctor() { -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (is_constant_evaluated()) { - return; - } -#endif // ^^^ workaround ^^^ - using Str = basic_string, StationaryAlloc>; { // Allocated @@ -2093,12 +2045,6 @@ constexpr void test_move_ctor() { template constexpr void test_move_alloc_ctor(const size_t id1, const size_t id2) { -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (is_constant_evaluated()) { - return; - } -#endif // ^^^ workaround ^^^ - using Str = basic_string, StationaryAlloc>; { // Allocated @@ -2127,12 +2073,6 @@ constexpr void test_move_alloc_ctor(const size_t id1, const size_t id2) { template constexpr void test_move_assign(const size_t id1, const size_t id2, const size_t id3) { -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (is_constant_evaluated()) { - return; - } -#endif // ^^^ workaround ^^^ - using Str = basic_string, Alloc>; // Iterators are taken over if the allocators are equal and source is large diff --git a/tests/std/tests/P1004R2_constexpr_vector/test.cpp b/tests/std/tests/P1004R2_constexpr_vector/test.cpp index 8bda2b9dcdb..37f298cb379 100644 --- a/tests/std/tests/P1004R2_constexpr_vector/test.cpp +++ b/tests/std/tests/P1004R2_constexpr_vector/test.cpp @@ -326,7 +326,7 @@ constexpr bool test_interface() { assert(c2 == 6); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726729 (attempt to access run-time storage) +#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1799670 (expired storage) if (!is_constant_evaluated()) #endif // ^^^ workaround ^^^ { // modifiers @@ -428,9 +428,6 @@ constexpr bool test_interface() { assert(equal(second.begin(), second.end(), begin(expected_second), end(expected_second))); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // erase vec erased{1, 2, 3, 4, 2, 3, 2}; erase(erased, 2); @@ -490,9 +487,6 @@ constexpr bool test_iterators() { assert(*cit == 2); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // advance auto it = range_constructed.begin() + 2; assert(*it == 2); @@ -517,9 +511,6 @@ constexpr bool test_iterators() { assert(*cit == 4); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // advance back auto it = range_constructed.end() - 2; assert(*it == 4); @@ -558,9 +549,6 @@ constexpr bool test_iterators() { assert(it3 >= it1); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // access const auto it = range_constructed.begin() + 2; it[2] = 3; @@ -625,15 +613,10 @@ constexpr bool test_growth() { vector l(3, 47); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - v.insert(v.end(), l.begin(), l.end()); + v.insert(v.end(), l.begin(), l.end()); - assert(v.size() == 1003); - assert(v.capacity() == 1500); - } + assert(v.size() == 1003); + assert(v.capacity() == 1500); } { @@ -644,15 +627,10 @@ constexpr bool test_growth() { vector l(7000, 47); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - v.insert(v.end(), l.begin(), l.end()); + v.insert(v.end(), l.begin(), l.end()); - assert(v.size() == 8000); - assert(v.capacity() == 8000); - } + assert(v.size() == 8000); + assert(v.capacity() == 8000); } { @@ -661,15 +639,10 @@ constexpr bool test_growth() { assert(v.size() == 1000); assert(v.capacity() == 1000); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - v.insert(v.end(), 3, 47); + v.insert(v.end(), 3, 47); - assert(v.size() == 1003); - assert(v.capacity() == 1500); - } + assert(v.size() == 1003); + assert(v.capacity() == 1500); } { @@ -678,15 +651,10 @@ constexpr bool test_growth() { assert(v.size() == 1000); assert(v.capacity() == 1000); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - v.insert(v.end(), 7000, 47); + v.insert(v.end(), 7000, 47); - assert(v.size() == 8000); - assert(v.capacity() == 8000); - } + assert(v.size() == 8000); + assert(v.capacity() == 8000); } return true; diff --git a/tests/std/tests/P1004R2_constexpr_vector_bool/test.cpp b/tests/std/tests/P1004R2_constexpr_vector_bool/test.cpp index 1531a3fa672..07c4cba9c77 100644 --- a/tests/std/tests/P1004R2_constexpr_vector_bool/test.cpp +++ b/tests/std/tests/P1004R2_constexpr_vector_bool/test.cpp @@ -101,65 +101,38 @@ constexpr bool test_interface() { // Non allocator constructors vec size_default_constructed(5); assert(size_default_constructed.size() == 5); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - assert(all_of( - size_default_constructed.begin(), size_default_constructed.end(), [](const bool val) { return !val; })); - } + assert(all_of( + size_default_constructed.begin(), size_default_constructed.end(), [](const bool val) { return !val; })); vec size_value_constructed(5, true); assert(size_value_constructed.size() == 5); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - assert(all_of( - size_value_constructed.begin(), size_value_constructed.end(), [](const bool val) { return val; })); - } + assert( + all_of(size_value_constructed.begin(), size_value_constructed.end(), [](const bool val) { return val; })); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - vec range_constructed(begin(input), end(input)); - assert(equal(range_constructed.begin(), range_constructed.end(), begin(input), end(input))); + vec range_constructed(begin(input), end(input)); + assert(equal(range_constructed.begin(), range_constructed.end(), begin(input), end(input))); - vec initializer_list_constructed({true, true, false, true}); - assert(equal(initializer_list_constructed.begin(), initializer_list_constructed.end(), begin(input) + 2, - end(input))); + vec initializer_list_constructed({true, true, false, true}); + assert(equal( + initializer_list_constructed.begin(), initializer_list_constructed.end(), begin(input) + 2, end(input))); - vec copy_assigned = range_constructed; - assert( - equal(copy_assigned.begin(), copy_assigned.end(), range_constructed.begin(), range_constructed.end())); + vec copy_assigned = range_constructed; + assert(equal(copy_assigned.begin(), copy_assigned.end(), range_constructed.begin(), range_constructed.end())); - vec move_assigned = move(copy_assigned); - assert( - equal(move_assigned.begin(), move_assigned.end(), range_constructed.begin(), range_constructed.end())); - assert(copy_assigned.empty()); // implementation-specific assumption that moved-from is empty - } + vec move_assigned = move(copy_assigned); + assert(equal(move_assigned.begin(), move_assigned.end(), range_constructed.begin(), range_constructed.end())); + assert(copy_assigned.empty()); // implementation-specific assumption that moved-from is empty // special member functions vec default_constructed; assert(default_constructed.empty()); vec copy_constructed(size_default_constructed); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - assert(equal(copy_constructed.begin(), copy_constructed.end(), size_default_constructed.begin(), - size_default_constructed.end())); - } + assert(equal(copy_constructed.begin(), copy_constructed.end(), size_default_constructed.begin(), + size_default_constructed.end())); vec move_constructed(move(copy_constructed)); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - assert(equal(move_constructed.begin(), move_constructed.end(), size_default_constructed.begin(), - size_default_constructed.end())); - } + assert(equal(move_constructed.begin(), move_constructed.end(), size_default_constructed.begin(), + size_default_constructed.end())); assert(copy_constructed.empty()); // implementation-specific assumption that moved-from is empty // allocator constructors @@ -173,70 +146,42 @@ constexpr bool test_interface() { assert(al_default_constructed.get_allocator().soccc_generation == 3); vec al_copy_constructed(size_value_constructed, alloc); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - assert(all_of(al_copy_constructed.begin(), al_copy_constructed.end(), [](const bool val) { return val; })); - } + assert(all_of(al_copy_constructed.begin(), al_copy_constructed.end(), [](const bool val) { return val; })); assert(al_copy_constructed.get_allocator().id == 4); assert(al_copy_constructed.get_allocator().soccc_generation == 3); vec al_move_constructed(move(al_copy_constructed), alloc); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - assert(all_of(al_move_constructed.begin(), al_move_constructed.end(), [](const bool val) { return val; })); - } + assert(all_of(al_move_constructed.begin(), al_move_constructed.end(), [](const bool val) { return val; })); assert(al_copy_constructed.empty()); // implementation-specific assumption that moved-from is empty assert(al_move_constructed.get_allocator().id == 4); assert(al_move_constructed.get_allocator().soccc_generation == 3); vec al_size_default_constructed(5, alloc); assert(al_size_default_constructed.size() == 5); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - assert(all_of(al_size_default_constructed.begin(), al_size_default_constructed.end(), - [](const bool val) { return !val; })); - } + assert(all_of(al_size_default_constructed.begin(), al_size_default_constructed.end(), + [](const bool val) { return !val; })); assert(al_size_default_constructed.get_allocator().id == 4); assert(al_size_default_constructed.get_allocator().soccc_generation == 3); vec al_size_value_constructed(5, true, alloc); assert(al_size_value_constructed.size() == 5); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - assert(all_of(al_size_value_constructed.begin(), al_size_value_constructed.end(), - [](const bool val) { return val; })); - } + assert(all_of( + al_size_value_constructed.begin(), al_size_value_constructed.end(), [](const bool val) { return val; })); assert(al_size_value_constructed.get_allocator().id == 4); assert(al_size_value_constructed.get_allocator().soccc_generation == 3); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - vec al_range_constructed(begin(input), end(input), alloc); - assert(equal(al_range_constructed.begin(), al_range_constructed.end(), begin(input), end(input))); - assert(al_range_constructed.get_allocator().id == 4); - assert(al_range_constructed.get_allocator().soccc_generation == 3); - - vec al_initializer_list_constructed({true, true, false, true}, alloc); - assert(equal(al_initializer_list_constructed.begin(), al_initializer_list_constructed.end(), - begin(input) + 2, end(input))); - assert(al_initializer_list_constructed.get_allocator().id == 4); - assert(al_initializer_list_constructed.get_allocator().soccc_generation == 3); - } + vec al_range_constructed(begin(input), end(input), alloc); + assert(equal(al_range_constructed.begin(), al_range_constructed.end(), begin(input), end(input))); + assert(al_range_constructed.get_allocator().id == 4); + assert(al_range_constructed.get_allocator().soccc_generation == 3); + + vec al_initializer_list_constructed({true, true, false, true}, alloc); + assert(equal(al_initializer_list_constructed.begin(), al_initializer_list_constructed.end(), begin(input) + 2, + end(input))); + assert(al_initializer_list_constructed.get_allocator().id == 4); + assert(al_initializer_list_constructed.get_allocator().soccc_generation == 3); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // assignment vec range_constructed(begin(input), end(input)); @@ -278,9 +223,6 @@ constexpr bool test_interface() { assert(alloc.soccc_generation == 0); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // iterators vec range_constructed(begin(input), end(input)); const vec const_range_constructed(begin(input), end(input)); @@ -334,9 +276,6 @@ constexpr bool test_interface() { assert(*prev(cre2)); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // access vec range_constructed(begin(input), end(input)); const vec const_range_constructed(begin(input), end(input)); @@ -385,9 +324,6 @@ constexpr bool test_interface() { assert(cb); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // capacity vec range_constructed(begin(input), end(input)); @@ -416,7 +352,7 @@ constexpr bool test_interface() { assert(c2 == 32); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) +#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1799670 (expired storage) if (!is_constant_evaluated()) #endif // ^^^ workaround ^^^ { // modifiers @@ -509,7 +445,7 @@ constexpr bool test_interface() { assert(emplaced.size() == 22); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) +#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1799670 (expired storage) if (!is_constant_evaluated()) #endif // ^^^ workaround ^^^ { @@ -524,9 +460,6 @@ constexpr bool test_interface() { assert(input_inserted.size() == size(num_arr)); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // swap vec first{true, false, true}; vec second{false, false, true, false}; @@ -538,7 +471,7 @@ constexpr bool test_interface() { assert(equal(second.begin(), second.end(), begin(expected_second), end(expected_second))); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) +#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1799670 (expired storage) if (!is_constant_evaluated()) #endif // ^^^ workaround ^^^ { // erase @@ -553,9 +486,6 @@ constexpr bool test_interface() { assert(equal(erased_if.begin(), erased_if.end(), begin(expected_erase_if), end(expected_erase_if))); } -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ { // comparison vec first(begin(input), end(input)); vec second(begin(input), end(input)); @@ -590,12 +520,6 @@ constexpr bool test_interface() { } constexpr bool test_iterators() { -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (is_constant_evaluated()) { - return true; - } -#endif // ^^^ workaround ^^^ - vec range_constructed(begin(input), end(input)); { // increment diff --git a/tests/std/tests/P1614R2_spaceship/test.cpp b/tests/std/tests/P1614R2_spaceship/test.cpp index 46303176e35..aee2e256ee3 100644 --- a/tests/std/tests/P1614R2_spaceship/test.cpp +++ b/tests/std/tests/P1614R2_spaceship/test.cpp @@ -1021,6 +1021,18 @@ void ordering_test_cases() { spaceship_test(p1, p3, p5); spaceship_test(p1, nullptr, p4); } + { // shared_ptr, heterogeneous + std::shared_ptr p1{}; + std::shared_ptr p2{}; + std::shared_ptr p3{}; + + std::shared_ptr p4{new int}; + + spaceship_test(p1, p2, p4); + spaceship_test(p1, p3, p4); + spaceship_test(p2, p3, p4); + spaceship_test(p1, nullptr, p4); + } { // slice std::slice a1(2, 3, 4); std::slice a2(2, 3, 4); diff --git a/tests/std/tests/P2321R2_proxy_reference/test.cpp b/tests/std/tests/P2321R2_proxy_reference/test.cpp index 59bdaa9e2ad..c9180eb5f7f 100644 --- a/tests/std/tests/P2321R2_proxy_reference/test.cpp +++ b/tests/std/tests/P2321R2_proxy_reference/test.cpp @@ -274,16 +274,12 @@ constexpr bool test() { { // Test vector::reference static_assert(is_assignable_v::reference, bool>); -#if defined(__EDG__) && _ITERATOR_DEBUG_LEVEL == 2 // TRANSITION, VSO-1726722 (attempt to access expired storage) - if (!is_constant_evaluated()) -#endif // ^^^ workaround ^^^ - { - vector vb{false}; - const vector::reference r = vb[0]; - - r = true; - assert(vb.front()); - } + + vector vb{false}; + const vector::reference r = vb[0]; + + r = true; + assert(vb.front()); } return true; diff --git a/tests/std/tests/P2465R3_standard_library_modules/env.lst b/tests/std/tests/P2465R3_standard_library_modules/env.lst index 09e0e46e6df..bce5b396773 100644 --- a/tests/std/tests/P2465R3_standard_library_modules/env.lst +++ b/tests/std/tests/P2465R3_standard_library_modules/env.lst @@ -13,6 +13,5 @@ PM_CL="/MD" PM_CL="/MDd" PM_CL="/MT" PM_CL="/MTd" -# TRANSITION, VSO-1705654 -# PM_CL="/MDd /analyze:only /analyze:autolog-" +PM_CL="/MDd /analyze:only /analyze:autolog-" PM_CL="/MDd /GR- /D_HAS_STATIC_RTTI=0" diff --git a/tests/std/tests/P2505R5_monadic_functions_for_std_expected/test.cpp b/tests/std/tests/P2505R5_monadic_functions_for_std_expected/test.cpp index 39b6ffcc483..69011d86d3f 100644 --- a/tests/std/tests/P2505R5_monadic_functions_for_std_expected/test.cpp +++ b/tests/std/tests/P2505R5_monadic_functions_for_std_expected/test.cpp @@ -8,28 +8,6 @@ using namespace std; -namespace detail { - static constexpr bool permissive() { - return false; - } - - template - struct DependentBase { - static constexpr bool permissive() { - return true; - } - }; - - template - struct Derived : DependentBase { - static constexpr bool test() { - return permissive(); - } - }; -} // namespace detail - -constexpr bool is_permissive = detail::Derived::test(); - enum class IsNothrowConstructible : bool { Not, Yes }; enum class IsNothrowConvertible : bool { Not, Yes }; @@ -144,18 +122,16 @@ constexpr void test_impl(Expected&& engaged, Expected&& unengaged) { } } - if constexpr (!is_permissive) { // TRANSITION, VSO-1734935 - { - decltype(auto) result = forward(engaged).transform(immov); - static_assert(is_same_v>); - assert(result->v == 88); - } - { - decltype(auto) result = forward(unengaged).transform(immov); - static_assert(is_same_v>); - assert(!result); - assert(result.error() == 22); - } + { + decltype(auto) result = forward(engaged).transform(immov); + static_assert(is_same_v>); + assert(result->v == 88); + } + { + decltype(auto) result = forward(unengaged).transform(immov); + static_assert(is_same_v>); + assert(!result); + assert(result.error() == 22); } { @@ -203,22 +179,20 @@ constexpr void test_impl(Expected&& engaged, Expected&& unengaged) { assert(result.error() == 66); } - if constexpr (!is_permissive) { // TRANSITION, VSO-1734935 - { - decltype(auto) result = forward(engaged).transform_error(immov); - static_assert(is_same_v>); - assert(result); - if constexpr (!is_void_v) { - assert(result->x == 11); - } - } - { - decltype(auto) result = forward(unengaged).transform_error(immov); - static_assert(is_same_v>); - assert(!result); - assert(result.error().v == 88); + { + decltype(auto) result = forward(engaged).transform_error(immov); + static_assert(is_same_v>); + assert(result); + if constexpr (!is_void_v) { + assert(result->x == 11); } } + { + decltype(auto) result = forward(unengaged).transform_error(immov); + static_assert(is_same_v>); + assert(!result); + assert(result.error().v == 88); + } const auto to_expected_thingy = [](auto...) { if constexpr (is_void_v) { diff --git a/tests/std/tests/VSO_0000000_allocator_propagation/test.cpp b/tests/std/tests/VSO_0000000_allocator_propagation/test.cpp index f419065724e..9e20357992f 100644 --- a/tests/std/tests/VSO_0000000_allocator_propagation/test.cpp +++ b/tests/std/tests/VSO_0000000_allocator_propagation/test.cpp @@ -295,13 +295,6 @@ _CONSTEXPR20 void test_sequence_swap(const size_t id1, const size_t id2) { template