Skip to content

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

Closed

Description

@Mizux

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

Activity

  1. added this to the v8.1 milestone on Oct 20, 2020
  2. self-assigned this
    on Oct 20, 2020
  3. added a commit that references this issue on Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions