-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
<cmath>: A compile-time warning C4244: 'argument': conversion from '_Common' to 'double' #3246
Comments
I guess this is a compiler bug - |
Thank you for your help, I have submitted two issues on this in the vs feedback section |
I agree with @frederick-vs-ja that the compiler shouldn't emit a warning here, but I also think that we should workaround the warning for this case as we do for many other Lines 334 to 343 in e28f956
- by converting the |
Minimized: // Compile with "cl /nologo /W4 /WX /Zs /diagnostics:caret"
extern "C" double __copysign(double, double);
void f(long double x, long double y) {
(void) __copysign(x, y); // C4244 (two places)
} Specifically, the compiler is diagnosing the conversions of |
This template implements the "sufficient additional overloads" for two-argument `<cmath>` functions (`atan2`, `hypot`, `pow`, `fmod`, `remainder`, `copysign`, `nextafter`, `fdim`, `fmax`, and `fmin`) by calling either an intrinsic or a C library function either of which expects `double` arguments. We previously converted the arguments to `_Common_float_type_t` which is `long double` when at least one argument is `long double`, resulting in narrowing conversion warnings at `/W4`. We now convert the arguments to `double` instead of `_Common_float_type_t`. Fixes microsoft#3246
This template implements the "sufficient additional overloads" for two-argument `<cmath>` functions (`atan2`, `hypot`, `pow`, `fmod`, `remainder`, `copysign`, `nextafter`, `fdim`, `fmax`, and `fmin`) by calling either an intrinsic or a C library function either of which expects `double` arguments. We previously converted the arguments to `_Common_float_type_t` which is `long double` when at least one argument is `long double`, resulting in narrowing conversion warnings at `/W4`. We now convert the arguments to `double` instead of `_Common_float_type_t`. Fixes microsoft#3246
Describe the bug
I found this annoying warning when I was idly testing my library and I'd like it to be dealt with reasonably well if possible
Command-line test case
Compile this program together with
/W4
and you will reasonably get a C4244 warningExpected behavior
no C4244 warning plz
STL version
Additional context
The original code is at https://godbolt.org/z/3eav315a1 if anyone needs it
The text was updated successfully, but these errors were encountered: