From 039211bcc1a8b611503af550eaf2f1b03e0ac72e Mon Sep 17 00:00:00 2001 From: Nick John Eliopoulos Date: Tue, 28 May 2024 11:00:51 -0400 Subject: [PATCH] Fix C++17 version detection in helper_macros.hpp (#1479) * It seems that __cplusplus can be inconsistent with _MSVC_LANG when discerning C++17 version. See https://github.com/NVIDIA/cutlass/issues/1474. Added switch to check _MSVC_LANG in addition to __cplusplus * Fixed typo. * Oops, another typo. * Changed incorrect logic, ifndef to ifdef * Define CUTLAS_CPLUSPLUS for language version testing Co-authored-by: Mark Hoemmen --------- Co-authored-by: Mark Hoemmen --- include/cutlass/detail/helper_macros.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/cutlass/detail/helper_macros.hpp b/include/cutlass/detail/helper_macros.hpp index d180d6dc9d..96d259d5eb 100644 --- a/include/cutlass/detail/helper_macros.hpp +++ b/include/cutlass/detail/helper_macros.hpp @@ -155,7 +155,13 @@ namespace cutlass { //////////////////////////////////////////////////////////////////////////////////////////////////// -#if (201700L <= __cplusplus) +#if defined(_MSVC_LANG) +# define CUTLASS_CPLUSPLUS _MSVC_LANG +#else +# define CUTLASS_CPLUSPLUS __cplusplus +#endif + +#if (201700L <= CUTLASS_CPLUSPLUS) #define CUTLASS_CONSTEXPR_IF_CXX17 constexpr #define CUTLASS_CXX17_OR_LATER 1 #else