From c0fe1fae72bcd6bce1dd83d951a4b740c1d17efe Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 12 Apr 2024 11:09:33 -0700 Subject: [PATCH] Toolset update: VS 2022 17.10 Preview 3 (#4576) --- README.md | 4 +- azure-devops/cmake-configure-build.yml | 1 - azure-devops/config.yml | 2 +- azure-devops/create-1es-hosted-pool.ps1 | 37 +-- azure-devops/provision-image.ps1 | 269 ++++-------------- stl/inc/exception | 6 - stl/inc/new | 10 - stl/inc/ranges | 14 - stl/inc/type_traits | 10 - stl/inc/typeinfo | 17 +- stl/modules/std.ixx | 78 ----- .../test.compile.pass.cpp | 2 +- tests/std/tests/P0898R3_concepts/test.cpp | 2 - 13 files changed, 71 insertions(+), 381 deletions(-) diff --git a/README.md b/README.md index 351d7588a1..80682b0ba3 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem # How To Build With The Visual Studio IDE -1. Install Visual Studio 2022 17.10 Preview 2 or later. +1. Install Visual Studio 2022 17.10 Preview 3 or later. * Select "Windows 11 SDK (10.0.22621.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. @@ -156,7 +156,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem # How To Build With A Native Tools Command Prompt -1. Install Visual Studio 2022 17.10 Preview 2 or later. +1. Install Visual Studio 2022 17.10 Preview 3 or later. * Select "Windows 11 SDK (10.0.22621.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. diff --git a/azure-devops/cmake-configure-build.yml b/azure-devops/cmake-configure-build.yml index 03605a8586..441be5792a 100644 --- a/azure-devops/cmake-configure-build.yml +++ b/azure-devops/cmake-configure-build.yml @@ -19,7 +19,6 @@ parameters: - name: litFlags type: object default: - - '--timeout=240' - '-j$(testParallelism)' - '--xunit-xml-output=$(buildOutputLocation)/test-results.xml' - '--order=lexical' diff --git a/azure-devops/config.yml b/azure-devops/config.yml index 33caf0b137..412ac16ed2 100644 --- a/azure-devops/config.yml +++ b/azure-devops/config.yml @@ -5,7 +5,7 @@ variables: - name: poolName - value: 'StlBuild-2024-03-12T1202-Pool' + value: 'StlBuild-2024-04-10T1048-Pool' readonly: true - name: poolDemands value: 'EnableSpotVM -equals true' diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index bba0c57a83..9aaf950bfd 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -60,28 +60,11 @@ function New-Password { Param([int]$Length = 32) # This 64-character alphabet generates 6 bits of entropy per character. - # The power-of-2 alphabet size allows us to select a character by masking a random Byte with bitwise-AND. - $alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-' - $mask = 63 - if ($alphabet.Length -ne 64) { - throw 'Bad alphabet length' - } - - [Byte[]]$randomData = [Byte[]]::new($Length) - $rng = $null - try { - $rng = [System.Security.Cryptography.RandomNumberGenerator]::Create() - $rng.GetBytes($randomData) - } - finally { - if ($null -ne $rng) { - $rng.Dispose() - } - } + $alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-'.ToCharArray() [SecureString] $result = [SecureString]::new() for ($idx = 0; $idx -lt $Length; $idx++) { - $result.AppendChar($alphabet[$randomData[$idx] -band $mask]) + $result.AppendChar((Get-SecureRandom -InputObject $alphabet)) } return $result @@ -121,6 +104,8 @@ function Wait-Shutdown { Display-ProgressBar -Status 'Silencing breaking change warnings' # https://aka.ms/azps-changewarnings +$Env:SuppressAzurePowerShellBreakingChangeWarnings = 'true' + Update-AzConfig ` -DisplayBreakingChangeWarning $false ` -Scope 'Process' | Out-Null @@ -231,10 +216,9 @@ $ProvisionImageResult = Invoke-AzVMRunCommand ` -ResourceGroupName $ResourceGroupName ` -VMName $ProtoVMName ` -CommandId 'RunPowerShellScript' ` - -ScriptPath "$PSScriptRoot\provision-image.ps1" ` - -Parameter @{ 'AdminUserPassword' = $AdminPW; } + -ScriptPath "$PSScriptRoot\provision-image.ps1" -Write-Host "provision-image.ps1 output: $($ProvisionImageResult.value.Message)" +Write-Host $ProvisionImageResult.value.Message #################################################################################################### Display-ProgressBar -Status 'Restarting VM' @@ -330,7 +314,7 @@ $ImageVersion = New-AzGalleryImageVersion ` -GalleryName $GalleryName ` -GalleryImageDefinitionName $ImageDefinitionName ` -Name $ImageVersionName ` - -SourceImageId $VM.ID + -SourceImageVMId $VM.ID #################################################################################################### Display-ProgressBar -Status 'Registering CloudTest resource provider' @@ -415,4 +399,9 @@ Remove-AzNetworkSecurityGroup ` Write-Progress -Activity $ProgressActivity -Completed Write-Host "Elapsed time: $(((Get-Date) - $CurrentDate).ToString('hh\:mm\:ss'))" -Write-Host "Finished creating pool: $PoolName" + +if ((Get-AzResource -ResourceGroupName $ResourceGroupName -Name $PoolName) -ne $null) { + Write-Host "Created pool: $PoolName" +} else { + Write-Error "Failed to create pool: $PoolName" +} diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index e68adf909c..ee3f0ab1a6 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -10,20 +10,10 @@ provision-image.ps1 runs on an existing, freshly provisioned virtual machine, and sets up that virtual machine as a build machine. After this is done, (outside of this script), we take that machine and make it an image to be copied for setting up new VMs in the scale set. - -This script must either be run as admin, or one must pass AdminUserPassword; -if the script is run with AdminUserPassword, it runs itself again as an -administrator. - -.PARAMETER AdminUserPassword -The administrator user's password; if this is $null, or not passed, then the -script assumes it's running on an administrator account. #> -param( - [string]$AdminUserPassword = $null -) $ErrorActionPreference = 'Stop' +$ProgressPreference = 'SilentlyContinue' <# .SYNOPSIS @@ -37,14 +27,11 @@ filename component in the temporary directory with that extension. The extension to use for the path. #> Function Get-TempFilePath { + [CmdletBinding(PositionalBinding=$false)] Param( - [String]$Extension + [Parameter(Mandatory)][String]$Extension ) - if ([String]::IsNullOrWhiteSpace($Extension)) { - throw 'Missing Extension' - } - $tempPath = [System.IO.Path]::GetTempPath() $tempName = [System.IO.Path]::GetRandomFileName() + '.' + $Extension return Join-Path $tempPath $tempName @@ -61,34 +48,22 @@ DownloadAndExtractZip returns a path containing the extracted contents. The URL of the ZIP file to download. #> Function DownloadAndExtractZip { + [CmdletBinding(PositionalBinding=$false)] Param( - [String]$Url + [Parameter(Mandatory)][String]$Url ) - if ([String]::IsNullOrWhiteSpace($Url)) { - throw 'Missing Url' - } - $ZipPath = Get-TempFilePath -Extension 'zip' - & curl.exe -L -o $ZipPath -s -S $Url + curl.exe -L -o $ZipPath -s -S $Url $TempSubdirPath = Get-TempFilePath -Extension 'dir' Expand-Archive -Path $ZipPath -DestinationPath $TempSubdirPath -Force + Remove-Item -Path $ZipPath return $TempSubdirPath } -$TranscriptPath = 'C:\provision-image-transcript.txt' - -if ([string]::IsNullOrEmpty($AdminUserPassword)) { - Start-Transcript -Path $TranscriptPath -UseMinimalHeader -} else { - Write-Host 'AdminUser password supplied; switching to AdminUser.' - - # https://learn.microsoft.com/en-us/sysinternals/downloads/psexec - $PsToolsZipUrl = 'https://download.sysinternals.com/files/PSTools.zip' - Write-Host "Downloading: $PsToolsZipUrl" - $ExtractedPsToolsPath = DownloadAndExtractZip -Url $PsToolsZipUrl - $PsExecPath = Join-Path $ExtractedPsToolsPath 'PsExec64.exe' +if ($PSVersionTable.PSVersion -lt [Version]::new('7.4.1')) { + Write-Host "Old PowerShell version: $($PSVersionTable.PSVersion)" # https://github.com/PowerShell/PowerShell/releases/latest $PowerShellZipUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/PowerShell-7.4.1-win-x64.zip' @@ -96,33 +71,21 @@ if ([string]::IsNullOrEmpty($AdminUserPassword)) { $ExtractedPowerShellPath = DownloadAndExtractZip -Url $PowerShellZipUrl $PwshPath = Join-Path $ExtractedPowerShellPath 'pwsh.exe' - $PsExecArgs = @( - '-u', - 'AdminUser', - '-p', - 'AdminUserPassword_REDACTED', - '-accepteula', - '-i', - '-h', - $PwshPath, + $PwshArgs = @( '-ExecutionPolicy', 'Unrestricted', '-File', $PSCommandPath ) - Write-Host "Executing: $PsExecPath $PsExecArgs" - $PsExecArgs[3] = $AdminUserPassword + Write-Host "Executing: $PwshPath $PwshArgs" + & $PwshPath $PwshArgs - $proc = Start-Process -FilePath $PsExecPath -ArgumentList $PsExecArgs -Wait -PassThru - Write-Host 'Reading transcript...' - Get-Content -Path $TranscriptPath Write-Host 'Cleaning up...' - Remove-Item -Recurse -Path $ExtractedPsToolsPath Remove-Item -Recurse -Path $ExtractedPowerShellPath - exit $proc.ExitCode + exit } -$Workloads = @( +$VisualStudioWorkloads = @( 'Microsoft.VisualStudio.Component.VC.ASAN', 'Microsoft.VisualStudio.Component.VC.CLI.Support', 'Microsoft.VisualStudio.Component.VC.CMake.Project', @@ -135,204 +98,78 @@ $Workloads = @( 'Microsoft.VisualStudio.Component.Windows11SDK.22621' ) -$VisualStudioBootstrapperUrl = 'https://aka.ms/vs/17/pre/vs_enterprise.exe' -$PythonUrl = 'https://www.python.org/ftp/python/3.12.2/python-3.12.2-amd64.exe' - -$CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_551.61_windows.exe' - -$ErrorActionPreference = 'Stop' -$ProgressPreference = 'SilentlyContinue' - -<# -.SYNOPSIS -Writes a message to the screen depending on ExitCode. - -.DESCRIPTION -Since msiexec can return either 0 or 3010 successfully, in both cases -we write that installation succeeded, and which exit code it exited with. -If msiexec returns anything else, we write an error. - -.PARAMETER ExitCode -The exit code that msiexec returned. -#> -Function PrintMsiExitCodeMessage { - Param( - $ExitCode - ) - - # 3010 is probably ERROR_SUCCESS_REBOOT_REQUIRED - if ($ExitCode -eq 0 -or $ExitCode -eq 3010) { - Write-Host "Installation successful! Exited with $ExitCode." - } - else { - Write-Error "Installation failed! Exited with $ExitCode." - } +$VisualStudioUrl = 'https://aka.ms/vs/17/pre/vs_enterprise.exe' +$VisualStudioArgs = @('--quiet', '--norestart', '--wait', '--nocache') +foreach ($workload in $VisualStudioWorkloads) { + $VisualStudioArgs += '--add' + $VisualStudioArgs += $workload } -<# -.SYNOPSIS -Install Visual Studio. - -.DESCRIPTION -InstallVisualStudio takes the $Workloads array, and installs it with the -installer that's pointed at by $BootstrapperUrl. +$PythonUrl = 'https://www.python.org/ftp/python/3.12.3/python-3.12.3-amd64.exe' +$PythonArgs = @('/quiet', 'InstallAllUsers=1', 'PrependPath=1', 'CompileAll=1', 'Include_doc=0') -.PARAMETER Workloads -The set of VS workloads to install. - -.PARAMETER BootstrapperUrl -The URL of the Visual Studio installer, i.e. one of vs_*.exe. -#> -Function InstallVisualStudio { - Param( - [String[]]$Workloads, - [String]$BootstrapperUrl - ) - - try { - Write-Host 'Downloading Visual Studio...' - [string]$bootstrapperExe = Get-TempFilePath -Extension 'exe' - curl.exe -L -o $bootstrapperExe -s -S $BootstrapperUrl - Write-Host 'Installing Visual Studio...' - $args = @('/c', $bootstrapperExe, '--quiet', '--norestart', '--wait', '--nocache') - foreach ($workload in $Workloads) { - $args += '--add' - $args += $workload - } - - $proc = Start-Process -FilePath cmd.exe -ArgumentList $args -Wait -PassThru - PrintMsiExitCodeMessage $proc.ExitCode - } - catch { - Write-Error "Failed to install Visual Studio! $($_.Exception.Message)" - } -} +$CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_551.61_windows.exe' +$CudaArgs = @('-s') <# .SYNOPSIS -Installs Python. +Download and install a component. .DESCRIPTION -InstallPython installs Python from the supplied URL. +DownloadAndInstall downloads an executable from the given URL, and runs it with the given command-line arguments. -.PARAMETER Url -The URL of the Python installer. -#> -Function InstallPython { - Param( - [String]$Url - ) - - Write-Host 'Downloading Python...' - [string]$installerPath = Get-TempFilePath -Extension 'exe' - curl.exe -L -o $installerPath -s -S $Url - Write-Host 'Installing Python...' - $proc = Start-Process -FilePath $installerPath -ArgumentList ` - @('/passive', 'InstallAllUsers=1', 'PrependPath=1', 'CompileAll=1') -Wait -PassThru - $exitCode = $proc.ExitCode - if ($exitCode -eq 0) { - Write-Host 'Installation successful!' - } - else { - Write-Error "Installation failed! Exited with $exitCode." - } -} - -<# -.SYNOPSIS -Installs NVIDIA's CUDA Toolkit. - -.DESCRIPTION -InstallCuda installs the CUDA Toolkit. +.PARAMETER Name +The name of the component, to be displayed in logging messages. .PARAMETER Url -The URL of the CUDA installer. +The URL of the installer. + +.PARAMETER Args +The command-line arguments to pass to the installer. #> -Function InstallCuda { +Function DownloadAndInstall { + [CmdletBinding(PositionalBinding=$false)] Param( - [String]$Url + [Parameter(Mandatory)][String]$Name, + [Parameter(Mandatory)][String]$Url, + [Parameter(Mandatory)][String[]]$Args ) try { - Write-Host 'Downloading CUDA...' + Write-Host "Downloading $Name..." [string]$installerPath = Get-TempFilePath -Extension 'exe' curl.exe -L -o $installerPath -s -S $Url - Write-Host 'Installing CUDA...' - $proc = Start-Process -FilePath $installerPath -ArgumentList @('-s') -Wait -PassThru + + Write-Host "Installing $Name..." + $proc = Start-Process -FilePath $installerPath -ArgumentList $Args -Wait -PassThru $exitCode = $proc.ExitCode + if ($exitCode -eq 0) { Write-Host 'Installation successful!' - } - else { + } elseif ($exitCode -eq 3010) { + Write-Host 'Installation successful! Exited with 3010 (ERROR_SUCCESS_REBOOT_REQUIRED).' + } else { Write-Error "Installation failed! Exited with $exitCode." } - } - catch { - Write-Error "Failed to install CUDA! $($_.Exception.Message)" - } -} - -<# -.SYNOPSIS -Install or upgrade a pip package. - -.DESCRIPTION -Installs or upgrades a pip package specified in $Package. -.PARAMETER Package -The name of the package to be installed or upgraded. -#> -Function PipInstall { - Param( - [String]$Package - ) - - try { - Write-Host "Installing or upgrading $Package..." - python.exe -m pip install --progress-bar off --upgrade $Package - Write-Host "Done installing or upgrading $Package." - } - catch { - Write-Error "Failed to install or upgrade $Package." + Remove-Item -Path $installerPath + } catch { + Write-Error "Installation failed! Exception: $($_.Exception.Message)" } } -Write-Host 'AdminUser password not supplied; assuming already running as AdminUser.' - # Print the Windows version, so we can verify whether Patch Tuesday has been picked up. cmd /c ver -InstallPython $PythonUrl -InstallVisualStudio -Workloads $Workloads -BootstrapperUrl $VisualStudioBootstrapperUrl -InstallCuda -Url $CudaUrl +DownloadAndInstall -Name 'Python' -Url $PythonUrl -Args $PythonArgs +DownloadAndInstall -Name 'Visual Studio' -Url $VisualStudioUrl -Args $VisualStudioArgs +DownloadAndInstall -Name 'CUDA' -Url $CudaUrl -Args $CudaArgs -Write-Host 'Updating PATH...' - -# Step 1: Read the system path, which was just updated by installing Python. -$currentSystemPath = [Environment]::GetEnvironmentVariable('Path', 'Machine') - -# Step 2: Update the local path (for this running script), so PipInstall can run python.exe. -# Additional directories can be added here (e.g. if we extracted a zip file -# or installed something that didn't update the system path). -$Env:PATH="$($currentSystemPath)" - -# Step 3: Update the system path, permanently recording any additional directories that were added in the previous step. -[Environment]::SetEnvironmentVariable('Path', "$Env:PATH", 'Machine') - -Write-Host 'Finished updating PATH!' - -Write-Host 'Running PipInstall...' - -PipInstall pip -PipInstall psutil - -Write-Host 'Finished running PipInstall!' - -Write-Host 'Setting other environment variables...' +Write-Host 'Setting environment variables...' # The STL's PR/CI builds are totally unrepresentative of customer usage. [Environment]::SetEnvironmentVariable('VSCMD_SKIP_SENDTELEMETRY', '1', 'Machine') -Write-Host 'Finished setting other environment variables!' - Write-Host 'Done!' + +exit diff --git a/stl/inc/exception b/stl/inc/exception index 3dcd538396..fa826df924 100644 --- a/stl/inc/exception +++ b/stl/inc/exception @@ -35,12 +35,6 @@ _STD_END _STD_BEGIN -#ifndef _VCRT_EXPORT_STD // TRANSITION, VCRuntime update expected in 17.10 Preview 3 -// Follow N4971 [module.interface]/6 by exporting aliases (a type alias is not an entity, N4971 [basic.pre]/3): -_EXPORT_STD using exception = exception; -_EXPORT_STD using bad_exception = bad_exception; -#endif // ^^^ workaround ^^^ - _EXPORT_STD using ::terminate; #ifndef _M_CEE_PURE diff --git a/stl/inc/new b/stl/inc/new index ce5517781f..e8f28cb06e 100644 --- a/stl/inc/new +++ b/stl/inc/new @@ -18,16 +18,6 @@ _STL_DISABLE_CLANG_WARNINGS #undef new _STD_BEGIN -#ifndef _VCRT_EXPORT_STD // TRANSITION, VCRuntime update expected in 17.10 Preview 3 -#if _HAS_EXCEPTIONS -// Follow N4971 [module.interface]/6 by exporting aliases (a type alias is not an entity, N4971 [basic.pre]/3): -_EXPORT_STD using bad_alloc = bad_alloc; -_EXPORT_STD using bad_array_new_length = bad_array_new_length; -#else // ^^^ _HAS_EXCEPTIONS / !_HAS_EXCEPTIONS vvv -// exports bad_alloc and bad_array_new_length. -#endif // ^^^ !_HAS_EXCEPTIONS ^^^ -#endif // ^^^ workaround ^^^ - #if _HAS_CXX20 _EXPORT_STD struct destroying_delete_t { explicit destroying_delete_t() = default; diff --git a/stl/inc/ranges b/stl/inc/ranges index 6ceaec735d..1407c82e45 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -8979,7 +8979,6 @@ namespace ranges { concept _Regular_invocable_with_repeated_type = _Regular_invocable_with_repeated_type_impl<_Fn, _Ty, make_index_sequence<_Nx>>; -#if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1975579 template struct _Invoke_result_with_repeated_type_impl; @@ -8991,19 +8990,6 @@ namespace ranges { template using _Invoke_result_with_repeated_type = _Invoke_result_with_repeated_type_impl<_Fn, _Ty, make_index_sequence<_Nx>>::type; -#else // ^^^ no workaround / workaround vvv - template - struct _Invoke_result_with_repeated_type_impl - : _Invoke_result_with_repeated_type_impl<_Fn, _Ty, _Nx - 1, _Ty, _Types...> {}; - - template - struct _Invoke_result_with_repeated_type_impl<_Fn, _Ty, 0, _Types...> { - using type = invoke_result_t<_Fn, _Types...>; - }; - - template - using _Invoke_result_with_repeated_type = _Invoke_result_with_repeated_type_impl<_Fn, _Ty, _Nx>::type; -#endif // ^^^ workaround ^^^ template concept _Adjacent_transform_constraints = diff --git a/stl/inc/type_traits b/stl/inc/type_traits index 4a93f007b2..43e2ca6a37 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -686,21 +686,11 @@ _EXPORT_STD template _CXX17_DEPRECATE_IS_LITERAL_TYPE constexpr bool is_literal_type_v = __is_literal_type(_Ty); #endif // _HAS_DEPRECATED_IS_LITERAL_TYPE -#if 1 // TRANSITION, VSO-119526 and LLVM-41915 -_EXPORT_STD template -struct is_trivial : bool_constant<__is_trivially_constructible(_Ty) && __is_trivially_copyable(_Ty)> { - // determine whether _Ty is a trivial type -}; - -_EXPORT_STD template -constexpr bool is_trivial_v = __is_trivially_constructible(_Ty) && __is_trivially_copyable(_Ty); -#else // ^^^ workaround / no workaround vvv _EXPORT_STD template struct is_trivial : bool_constant<__is_trivial(_Ty)> {}; // determine whether _Ty is a trivial type _EXPORT_STD template constexpr bool is_trivial_v = __is_trivial(_Ty); -#endif // ^^^ no workaround ^^^ _EXPORT_STD template struct is_trivially_copyable : bool_constant<__is_trivially_copyable(_Ty)> { diff --git a/stl/inc/typeinfo b/stl/inc/typeinfo index 1f9628652e..e7df437d17 100644 --- a/stl/inc/typeinfo +++ b/stl/inc/typeinfo @@ -23,27 +23,12 @@ _STL_DISABLE_CLANG_WARNINGS #include #pragma pop_macro("raw_name") -#ifndef _VCRT_EXPORT_STD // TRANSITION, VCRuntime update expected in 17.10 Preview 3 -// Follow N4971 [module.interface]/6 by exporting aliases (a type alias is not an entity, N4971 [basic.pre]/3): -_EXPORT_STD using type_info = type_info; // for typeid, MSVC looks for type_info in the global namespace -#endif // ^^^ workaround ^^^ - _STD_BEGIN // size in pointers of std::function and std::any (roughly 3 pointers larger than std::string when building debug) _INLINE_VAR constexpr int _Small_object_num_ptrs = 6 + 16 / sizeof(void*); -#ifndef _VCRT_EXPORT_STD // TRANSITION, VCRuntime update expected in 17.10 Preview 3 -_EXPORT_STD using ::type_info; -#endif // ^^^ workaround ^^^ - -#if _HAS_EXCEPTIONS -#ifndef _VCRT_EXPORT_STD // TRANSITION, VCRuntime update expected in 17.10 Preview 3 -// Follow N4971 [module.interface]/6 by exporting aliases (a type alias is not an entity, N4971 [basic.pre]/3): -_EXPORT_STD using bad_cast = bad_cast; -_EXPORT_STD using bad_typeid = bad_typeid; -#endif // ^^^ workaround ^^^ -#else // ^^^ _HAS_EXCEPTIONS / !_HAS_EXCEPTIONS vvv +#if !_HAS_EXCEPTIONS _EXPORT_STD class bad_cast : public exception { // base of all bad cast exceptions public: bad_cast(const char* _Message = "bad cast") noexcept : exception(_Message) {} diff --git a/stl/modules/std.ixx b/stl/modules/std.ixx index 0aa355d9e8..7a5fdbf7ce 100644 --- a/stl/modules/std.ixx +++ b/stl/modules/std.ixx @@ -36,84 +36,6 @@ export module std; #pragma warning(push) #pragma warning(disable : 5244) // '#include ' in the purview of module 'std' appears erroneous. -#include -#ifndef _VCRT_EXPORT_STD // TRANSITION, VCRuntime update expected in 17.10 Preview 3 - -// N4971 [module.interface]/6: "A redeclaration of an entity X is implicitly exported -// if X was introduced by an exported declaration; otherwise it shall not be exported." - -// Therefore, we need to introduce exported declarations of machinery before including it. - -#pragma pack(push, _CRT_PACKING) -#pragma warning(push, _STL_WARNING_LEVEL) -#pragma warning(disable : _STL_DISABLED_WARNINGS) -_STL_DISABLE_CLANG_WARNINGS -#pragma push_macro("new") -#undef new - -_STD_BEGIN -export extern "C++" struct nothrow_t; - -export extern "C++" const nothrow_t nothrow; - -#ifdef __cpp_aligned_new -export extern "C++" enum class align_val_t : size_t; -#endif // ^^^ defined(__cpp_aligned_new) ^^^ -_STD_END - -export extern "C++" _NODISCARD _Ret_notnull_ _Post_writable_byte_size_(_Size) -_VCRT_ALLOCATOR void* __CRTDECL operator new(size_t _Size); -export extern "C++" _NODISCARD _Ret_maybenull_ _Success_(return != NULL) - _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR void* __CRTDECL - operator new(size_t _Size, const _STD nothrow_t&) noexcept; -export extern "C++" _NODISCARD _Ret_notnull_ _Post_writable_byte_size_(_Size) -_VCRT_ALLOCATOR void* __CRTDECL operator new[](size_t _Size); -export extern "C++" _NODISCARD _Ret_maybenull_ _Success_(return != NULL) - _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR void* __CRTDECL - operator new[](size_t _Size, const _STD nothrow_t&) noexcept; -export extern "C++" void __CRTDECL operator delete(void* _Block) noexcept; -export extern "C++" void __CRTDECL operator delete(void* _Block, size_t _Size) noexcept; -export extern "C++" void __CRTDECL operator delete(void* _Block, const _STD nothrow_t&) noexcept; -export extern "C++" void __CRTDECL operator delete[](void* _Block) noexcept; -export extern "C++" void __CRTDECL operator delete[](void* _Block, size_t _Size) noexcept; -export extern "C++" void __CRTDECL operator delete[](void* _Block, const _STD nothrow_t&) noexcept; - -#ifdef __cpp_aligned_new -export extern "C++" _NODISCARD _Ret_notnull_ _Post_writable_byte_size_(_Size) -_VCRT_ALLOCATOR void* __CRTDECL operator new(size_t _Size, _STD align_val_t _Al); -export extern "C++" _NODISCARD _Ret_maybenull_ _Success_(return != NULL) - _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR void* __CRTDECL - operator new(size_t _Size, _STD align_val_t _Al, const _STD nothrow_t&) noexcept; -export extern "C++" _NODISCARD _Ret_notnull_ _Post_writable_byte_size_(_Size) -_VCRT_ALLOCATOR void* __CRTDECL operator new[](size_t _Size, _STD align_val_t _Al); -export extern "C++" _NODISCARD _Ret_maybenull_ _Success_(return != NULL) - _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR void* __CRTDECL - operator new[](size_t _Size, _STD align_val_t _Al, const _STD nothrow_t&) noexcept; -export extern "C++" void __CRTDECL operator delete(void* _Block, _STD align_val_t _Al) noexcept; -export extern "C++" void __CRTDECL operator delete(void* _Block, size_t _Size, _STD align_val_t _Al) noexcept; -export extern "C++" void __CRTDECL operator delete(void* _Block, _STD align_val_t _Al, const _STD nothrow_t&) noexcept; -export extern "C++" void __CRTDECL operator delete[](void* _Block, _STD align_val_t _Al) noexcept; -export extern "C++" void __CRTDECL operator delete[](void* _Block, size_t _Size, _STD align_val_t _Al) noexcept; -export extern "C++" void __CRTDECL operator delete[]( - void* _Block, _STD align_val_t _Al, const _STD nothrow_t&) noexcept; -#endif // ^^^ defined(__cpp_aligned_new) ^^^ - -export extern "C++" _NODISCARD _MSVC_CONSTEXPR _Ret_notnull_ _Post_writable_byte_size_(_Size) - _Post_satisfies_(return == _Where) void* __CRTDECL - operator new(size_t _Size, _Writable_bytes_(_Size) void* _Where) noexcept; -export extern "C++" _NODISCARD _Ret_notnull_ _Post_writable_byte_size_(_Size) - _Post_satisfies_(return == _Where) void* __CRTDECL - operator new[](size_t _Size, _Writable_bytes_(_Size) void* _Where) noexcept; -export extern "C++" void __CRTDECL operator delete(void*, void*) noexcept; -export extern "C++" void __CRTDECL operator delete[](void*, void*) noexcept; - -#pragma pop_macro("new") -_STL_RESTORE_CLANG_WARNINGS -#pragma warning(pop) -#pragma pack(pop) - -#endif // ^^^ workaround ^^^ - // "C++ library headers" [tab:headers.cpp] #include #if _HAS_STATIC_RTTI diff --git a/tests/std/tests/P0896R4_ranges_algorithm_machinery/test.compile.pass.cpp b/tests/std/tests/P0896R4_ranges_algorithm_machinery/test.compile.pass.cpp index 42755c4908..e91f883794 100644 --- a/tests/std/tests/P0896R4_ranges_algorithm_machinery/test.compile.pass.cpp +++ b/tests/std/tests/P0896R4_ranges_algorithm_machinery/test.compile.pass.cpp @@ -522,7 +522,7 @@ namespace dangling_test { STATIC_ASSERT(std::is_class_v); STATIC_ASSERT(std::semiregular); - STATIC_ASSERT(std::is_trivial_v); // not guaranteed, but likely portable nonetheless + STATIC_ASSERT(std::is_trivially_default_constructible_v); // dangling is constructible from any sequence of arguments without throwing STATIC_ASSERT(is_nothrow_constructible_v); diff --git a/tests/std/tests/P0898R3_concepts/test.cpp b/tests/std/tests/P0898R3_concepts/test.cpp index 7a1f6a4ab6..25d325f814 100644 --- a/tests/std/tests/P0898R3_concepts/test.cpp +++ b/tests/std/tests/P0898R3_concepts/test.cpp @@ -2223,7 +2223,6 @@ namespace test_copy_constructible { STATIC_ASSERT(test()); STATIC_ASSERT(!test()); -#if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-119526 // https://github.com/ericniebler/stl2/issues/301 struct NotMutableRef { NotMutableRef() = default; @@ -2240,7 +2239,6 @@ namespace test_copy_constructible { STATIC_ASSERT(!copy_constructible); STATIC_ASSERT(!copy_constructible); -#endif // ^^^ no workaround ^^^ struct UserProvidedCopy { UserProvidedCopy(UserProvidedCopy const&);