Skip to content

Conversation

StephanTLavavej
Copy link
Member

Fixes #4899 by adding workarounds for DevCom-10729775.

I slightly reduced the test case from uniform_real_distribution, then verified that the generate_canonical test coverage fails without the workaround (for both Standard Library Modules and Standard Library Header Units), before passing with the workaround.

_Signed128 has the same code pattern, and I was able to craft a highly contrived repro demonstrating that it needs the same workaround. I don't think we need to add automated test coverage for it, though.

Click to expand bonus repro:
C:\Temp>"C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" x64
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.12.0-pre.1.0
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\Temp>type meow.cpp
import std;
using namespace std;

constexpr long long meow() {
    const auto v = views::iota(0ll, 1729ll);
    const auto b = ranges::begin(v);
    const auto e = ranges::end(v);
    return static_cast<long long>(e - b);
}

int main() {
    constexpr long long value = meow();
    static_assert(value == 1729ll);
}
C:\Temp>cl /EHsc /nologo /W4 /std:c++latest /MTd /Od /c "%VCToolsInstallDir%\modules\std.ixx"
std.ixx

C:\Temp>cl /EHsc /nologo /W4 /std:c++latest /MTd /Od meow.cpp std.obj
meow.cpp
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34226\include\__msvc_int128.hpp(1184): error C2512: 'std::_Signed128': no appropriate default constructor available
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34226\include\ranges(887): note: while evaluating constexpr function 'std::operator -'
meow.cpp(8): note: while evaluating constexpr function 'std::ranges::operator -'
meow.cpp(12): note: while evaluating constexpr function 'meow'
meow.cpp(12): error C2131: expression did not evaluate to a constant
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34226\include\__msvc_int128.hpp(1184): note: a non-constant (sub-)expression was encountered
meow.cpp(13): error C2131: expression did not evaluate to a constant
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34226\include\__msvc_int128.hpp(1184): note: a non-constant (sub-)expression was encountered

@StephanTLavavej StephanTLavavej added bug Something isn't working modules C++23 modules, C++20 header units labels Aug 23, 2024
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner August 23, 2024 01:05
@CaseyCarter CaseyCarter removed their assignment Aug 23, 2024
@StephanTLavavej StephanTLavavej self-assigned this Aug 25, 2024
@StephanTLavavej
Copy link
Member Author

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej
Copy link
Member Author

I had to push an additional commit to work around VSO-2226569 "Standard Library Modules: generate_canonical causes C1XX ICE: find_pending_comparison_function_for_definition(function) == std::end(pending_comparison_functions_for_definition)".

@StephanTLavavej StephanTLavavej merged commit 138e116 into microsoft:main Aug 25, 2024
@StephanTLavavej StephanTLavavej deleted the rand-al-workaround branch August 25, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working modules C++23 modules, C++20 header units

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Standard Library Modules: uniform_real_distribution emits error C2512: 'std::_Unsigned128': no appropriate default constructor available

2 participants