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

Windows failure std::isnan(int32) is ambiguous #2200

Closed
Mizux opened this issue Oct 20, 2020 · 0 comments
Closed

Windows failure std::isnan(int32) is ambiguous #2200

Mizux opened this issue Oct 20, 2020 · 0 comments
Assignees
Labels
Bug Lang: C++ Native implementation issue OS: Windows Windows OS
Projects
Milestone

Comments

@Mizux
Copy link
Collaborator

Mizux commented Oct 20, 2020

This line won't compile on windows

const int32 improvement_rate_solutions_distance =
search_parameters.improvement_limit_parameters()
.improvement_rate_solutions_distance();
if (std::isnan(improvement_rate_solutions_distance) ||
improvement_rate_solutions_distance <= 0) {

note, std::isnan should be defined for IntegralType

bool isnan( IntegralType arg ); | (4) | (since C++11)
4) A set of overloads or a function template accepting the arg argument of any integral type.
Equivalent to (2) (the argument is cast to double).

ref: https://en.cppreference.com/w/cpp/numeric/math/isnan

cl /std:c++17 /EHsc /MD /nologo -nologo  /D__WIN32__ /DPSAPI_VERSION=1 /DNOMINMAX /DWIN32_LEAN_AND_MEAN=1 /D_CRT_SECURE_NO_WARNINGS /O2 -DNDEBUG /I. /Iortools/gen /DUSE_GLOP /DUSE_BOP     /I"dependencies\\install\\include" /I"dependencies\\install\\include" /DGFLAGS_DLL_DECL= /DGFLAGS_DLL_DECLARE_FLAG= /DGFLAGS_DLL_DEFINE_FLAG= /I"dependencies\\install\\include" /DGOOGLE_GLOG_DLL_DECL= /I"dependencies\\install\\include" /I"dependencies\\install\\include" /I"dependencies\\install\\include" /I"dependencies\\install\\include\\coin" /I"dependencies\\install\\include" /I"dependencies\\install\\include\\coin" /I"dependencies\\install\\include" /I"dependencies\\install\\include\\coin" /DUSE_CLP /I"dependencies\\install\\include" /I"dependencies\\install\\include\\coin" /I"dependencies\\install\\include" /I"dependencies\\install\\include\\coin" /DUSE_CBC /I"dependencies\\install\\include" /DUSE_SCIP /DNO_CONFIG_HEADER  /DOR_TOOLS_MAJOR=8 /DOR_TOOLS_MINOR=0 -c .\\ortools\\constraint_solver\\routing_parameters.cc /Foobjs\\constraint_solver\\routing_parameters.obj
routing_parameters.cc
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\corecrt_math.h(413): error C2668: 'fpclassify': ambiguous call to overloaded function
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\corecrt_math.h(298): note: could be 'int fpclassify(long double) noexcept'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\corecrt_math.h(293): note: or       'int fpclassify(double) noexcept'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\corecrt_math.h(288): note: or       'int fpclassify(float) noexcept'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\corecrt_math.h(413): note: while trying to match the argument list '(_Ty)'
        with
        [
            _Ty=int32
        ]
.\ortools\constraint_solver\routing_parameters.cc(316): note: see reference to function template instantiation 'bool isnan<int32>(_Ty) noexcept' being compiled
        with
        [
            _Ty=int32
        ]
make: *** [makefiles/Makefile.gen.mk:4108: objs/constraint_solver/routing_parameters.obj] Error 2

I suggest to cast the int32 to double

@Mizux Mizux added Bug OS: Windows Windows OS Lang: C++ Native implementation issue labels Oct 20, 2020
@Mizux Mizux added this to the v8.1 milestone Oct 20, 2020
@Mizux Mizux self-assigned this Oct 20, 2020
@Mizux Mizux added this to To do in ToDo via automation Oct 20, 2020
@Mizux Mizux moved this from To do to In progress in ToDo Oct 20, 2020
@Mizux Mizux closed this as completed in 4f2d748 Oct 20, 2020
ToDo automation moved this from In progress to Done Oct 20, 2020
Mizux added a commit that referenced this issue Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Lang: C++ Native implementation issue OS: Windows Windows OS
Projects
ToDo
  
Done
Development

No branches or pull requests

1 participant