mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
Eigen: Fix MSVC C++17 language standard detection logic
To detect C++17 support, use _MSVC_LANG macro instead of _MSC_VER. _MSC_VER can indicate whether the current compiler version could support the C++17 language standard, but not whether that standard is actually selected (i.e. via /std:c++17). See these web pages for more details: https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros
This commit is contained in:
parent
e9f0eb8a5e
commit
ff06ef7584
@ -109,7 +109,7 @@
|
||||
#endif
|
||||
|
||||
// For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC:
|
||||
// name ver MSC_VER
|
||||
// name ver MSC_VER
|
||||
// 2008 9 1500
|
||||
// 2010 10 1600
|
||||
// 2012 11 1700
|
||||
@ -122,6 +122,19 @@
|
||||
// 2017-14.13 15.6 1913
|
||||
// 2017-14.14 15.7 1914
|
||||
|
||||
/// \internal EIGEN_COMP_MSVC_LANG set to _MSVC_LANG if the compiler is Microsoft Visual C++, 0 otherwise.
|
||||
#if defined(_MSVC_LANG)
|
||||
#define EIGEN_COMP_MSVC_LANG _MSVC_LANG
|
||||
#else
|
||||
#define EIGEN_COMP_MSVC_LANG 0
|
||||
#endif
|
||||
|
||||
// For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC_LANG:
|
||||
// MSVC option Standard MSVC_LANG
|
||||
// /std:c++14 (default as of VS 2019) C++14 201402L
|
||||
// /std:c++17 C++17 201703L
|
||||
// /std:c++latest >C++17 >201703L
|
||||
|
||||
/// \internal EIGEN_COMP_MSVC_STRICT set to 1 if the compiler is really Microsoft Visual C++ and not ,e.g., ICC or clang-cl
|
||||
#if EIGEN_COMP_MSVC && !(EIGEN_COMP_ICC || EIGEN_COMP_LLVM || EIGEN_COMP_CLANG)
|
||||
#define EIGEN_COMP_MSVC_STRICT _MSC_VER
|
||||
@ -512,7 +525,7 @@
|
||||
// The macro EIGEN_COMP_CXXVER defines the c++ verson expected by the compiler.
|
||||
// For instance, if compiling with gcc and -std=c++17, then EIGEN_COMP_CXXVER
|
||||
// is defined to 17.
|
||||
#if (defined(__cplusplus) && (__cplusplus > 201402L) || EIGEN_COMP_MSVC >= 1914)
|
||||
#if (defined(__cplusplus) && (__cplusplus > 201402L) || EIGEN_COMP_MSVC_LANG > 201402L)
|
||||
#define EIGEN_COMP_CXXVER 17
|
||||
#elif (defined(__cplusplus) && (__cplusplus > 201103L) || EIGEN_COMP_MSVC >= 1910)
|
||||
#define EIGEN_COMP_CXXVER 14
|
||||
|
Loading…
Reference in New Issue
Block a user