Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tolerate 80-bit long double in <xlocnum> #4032

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

StephanTLavavej
Copy link
Member

STL/stl/inc/xlocnum

Lines 615 to 622 in 8f67ece

virtual _InIt __CLR_OR_THIS_CALL do_get(_InIt _First, _InIt _Last, ios_base& _Iosbase, ios_base::iostate& _State,
long double& _Val) const { // get long double from [_First, _Last) into _Val
static_assert(sizeof(double) == sizeof(long double), "Bad assumption: sizeof(double) == sizeof(long double).");
double _Result;
_First = num_get::do_get(_First, _Last, _Iosbase, _State, _Result); // avoid virtual call for perf
_Val = _Result;
return _First;
}

This was introduced by MSVC-PR-113746 on 2018-03-29.

In DevCom-10465513, a user has reported that this prevents compilation with the Intel compiler in 80-bit long double mode. We don't support the Intel compiler and we especially don't support 80-bit long double, but we have an unofficial policy of avoiding gratuitous breakage when doing so is easy. In this case, merely omitting the static_assert and explaining the assumption with a comment has no impact for MSVC/Clang users, and allows Intel 80-bit users to compile.

I checked the STL for other occurrences and this appears to be the only such static_assert about long double's size in the product code.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Sep 15, 2023
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner September 15, 2023 21:45
@StephanTLavavej StephanTLavavej self-assigned this Sep 20, 2023
@StephanTLavavej
Copy link
Member Author

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

@StephanTLavavej StephanTLavavej merged commit 1c928ac into microsoft:main Sep 21, 2023
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants