coin-or / OS

Optimization Services
Other
1 stars 4 forks source link

OS fails to build with MSVC 14 #63

Open svigerske opened 5 years ago

svigerske commented 5 years ago

Issue created by migration from Trac.

Original creator: @tkralphs

Original creation time: 2018-01-07 20:24:23

Version:

You are doing some implicit type conversions that aren't allowed in Visual Studio.

../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(3944): error C2440: 'type cast': cannot convert from 'double' to 'ENUM_MATRIX_TYPE' ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(3944): note: Conversions between enumeration and floating point values are no longer allowed ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(3946): error C2440: 'type cast': cannot convert from 'double' to 'ENUM_MATRIX_SYMMETRY' ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(3946): note: Conversions between enumeration and floating point values are no longer allowed ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(4044): error C2440: 'type cast': cannot convert from 'double' to 'ENUM_MATRIX_TYPE' ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(4044): note: Conversions between enumeration and floating point values are no longer allowed ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(4046): error C2440: 'type cast': cannot convert from 'double' to 'ENUM_MATRIX_SYMMETRY' ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(4046): note: Conversions between enumeration and floating point values are no longer allowed ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(4144): error C2440: 'type cast': cannot convert from 'double' to 'ENUM_MATRIX_TYPE' ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(4144): note: Conversions between enumeration and floating point values are no longer allowed ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(4146): error C2440: 'type cast': cannot convert from 'double' to 'ENUM_MATRIX_SYMMETRY' ../../../../OS/src/OSCommonInterfaces/OSMatrix.cpp(4146): note: Conversions between enumeration and floating point values are no longer allowed

svigerske commented 5 years ago

Comment by @tkralphs created at 2018-01-07 20:39:37

Casting to "int" first fixes the error:

https://stackoverflow.com/questions/17083596/double-to-enum-cast-warns-types-mixed

although it seems like kind of an ugly hack.