Skip to content

Conversation

Radnyx
Copy link

@Radnyx Radnyx commented Oct 9, 2025

Another patch to get the MSVC build going.

The chrono_literals operator""s actually has an unspecified return type (https://eel.is/c++draft/time.duration.literals).
So library implementations can end up with either double or long double as the duration rep. For instance,

Clang's implementation:

_LIBCPP_HIDE_FROM_ABI constexpr chrono::duration<long double> operator""s(long double __s) {
  return chrono::duration<long double>(__s);
}

MSVC's implementation:

_EXPORT_STD _NODISCARD constexpr _CHRONO duration<double> operator""s(long double _Val) noexcept
/* strengthened */ {
    return _CHRONO duration<double>(_Val);
}

I changed the assertion to grab the rep from the result of calling the operator. Looks a bit tautological, but it works.

@Radnyx Radnyx marked this pull request as ready for review October 10, 2025 00:10
Copy link
Owner

@mpusz mpusz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was unaware of that. Thanks!

@mpusz mpusz merged commit 5be02cf into mpusz:master Oct 11, 2025
65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants