-
Notifications
You must be signed in to change notification settings - Fork 959
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
operator/(duration, duration) cannot be used #555
Comments
Further research: While SFINAE seems to fix this problem, the root cause is likely that EASTL is missing an enable_if. The standard says regarding operator/(duration, number): "This operator shall not participate in overload resolution unless Rep2 is implicitly convertible to CR(Rep1, Rep2) and Rep2 is not a specialization of duration." - this is not guarded in EASTL |
mtnpke
changed the title
operator/(duration, duration) cannot be used because common_type is SFINAE-unfriendly
operator/(duration, duration) cannot be used
Jan 28, 2025
mtnpke
added a commit
to mtnpke/EASTL
that referenced
this issue
Jan 28, 2025
The division of two durations does not return in a duration, but a plain number. Also, the (duration, number) overloads of operator/ and operator% shall not participate in overload resolution if Rep2 is a duration. Fixes electronicarts#554, electronicarts#555.
mtnpke
added a commit
to mtnpke/EASTL
that referenced
this issue
Jan 28, 2025
The (duration, number) overloads of operator/ and operator% shall not participate in overload resolution if Rep2 is a duration. Fixes electronicarts#555.
This was referenced Jan 28, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trying to invoke operator/(duration, duration) yields to compile errors on MSVC because it tries to instantiate the other overload - operator/(duration, number) - and fails in determining the common_type of the arguments. This failure is fatal because EASTL includes the original C++11 common_type definition that is not SFINAE-friendly. This was later acknowledged in N3843 and fixed for C++17 in LWG2408.
(This is irrespective of and a separate issue to #554)
Example code:
Error message:
Compiler version: Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33817 for x64
The text was updated successfully, but these errors were encountered: