From 3b071a148026ad6f6b2e680992354191a7a853b2 Mon Sep 17 00:00:00 2001 From: David Sankel Date: Wed, 13 Nov 2024 13:40:47 -0500 Subject: [PATCH 1/3] Add MSVC-specific deducing-this check This compiler, like clang, doesn't properly advertise deducing this support. I really don't know the point of these feature test macros if we have to work around them not being used for almost every compiler. :( --- cmake/CompilerFeatureTest.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/CompilerFeatureTest.cmake b/cmake/CompilerFeatureTest.cmake index df9b294..bae55bb 100644 --- a/cmake/CompilerFeatureTest.cmake +++ b/cmake/CompilerFeatureTest.cmake @@ -12,7 +12,8 @@ include(CheckCXXSourceCompiles) function(beman_iterator_check_deducing_this result_var) check_cxx_source_compiles( " // clang-specific check due to http://github.com/llvm/llvm-project/issues/113174 -#if defined(__cpp_explicit_this_parameter) || (defined(__clang__) && __has_extension(cxx_explicit_this_parameter)) +// MSVC-specific check due to https://developercommunity.visualstudio.com/t/10107077 +#if defined(__cpp_explicit_this_parameter) || (defined(__clang__) && __has_extension(cxx_explicit_this_parameter)) || (defined(_MSC_VER) && _MSC_VER >= 1932) #else #error No deducing this support #endif From 2ddc5acb5e5dc8669751005730ce97b8dc143d35 Mon Sep 17 00:00:00 2001 From: David Sankel Date: Wed, 13 Nov 2024 14:09:25 -0500 Subject: [PATCH 2/3] Made multiple branches to work around MSVC preprocessor issue --- cmake/CompilerFeatureTest.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmake/CompilerFeatureTest.cmake b/cmake/CompilerFeatureTest.cmake index bae55bb..47c9709 100644 --- a/cmake/CompilerFeatureTest.cmake +++ b/cmake/CompilerFeatureTest.cmake @@ -13,9 +13,17 @@ function(beman_iterator_check_deducing_this result_var) check_cxx_source_compiles( " // clang-specific check due to http://github.com/llvm/llvm-project/issues/113174 // MSVC-specific check due to https://developercommunity.visualstudio.com/t/10107077 -#if defined(__cpp_explicit_this_parameter) || (defined(__clang__) && __has_extension(cxx_explicit_this_parameter)) || (defined(_MSC_VER) && _MSC_VER >= 1932) +#if defined(__cpp_explicit_this_parameter) #else -#error No deducing this support + #if defined(_MSC_VER) && (_MSC_VER >= 1932) + #elif defined(__clang__) + #if __has_extension(cxx_explicit_this_parameter)) + #else + #error No deducing this support + #endif + #else + #error No deducing this support + #endif #endif int main(){} " HAVE_DEDUCING_THIS ) From 8da168e8a4f1c27f259a26fc0760c86d29a1e533 Mon Sep 17 00:00:00 2001 From: David Sankel Date: Wed, 13 Nov 2024 14:43:24 -0500 Subject: [PATCH 3/3] Fix paren issue --- cmake/CompilerFeatureTest.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CompilerFeatureTest.cmake b/cmake/CompilerFeatureTest.cmake index 47c9709..99bc65d 100644 --- a/cmake/CompilerFeatureTest.cmake +++ b/cmake/CompilerFeatureTest.cmake @@ -17,7 +17,7 @@ function(beman_iterator_check_deducing_this result_var) #else #if defined(_MSC_VER) && (_MSC_VER >= 1932) #elif defined(__clang__) - #if __has_extension(cxx_explicit_this_parameter)) + #if __has_extension(cxx_explicit_this_parameter) #else #error No deducing this support #endif