Skip to content

Commit 0b0d7af

Browse files
committed
build: explicit_this enabled for AppleClang 17 and MSVC 19.32
Both compilers do not implement the feature test macro, but they do implement `explicit_this`, as mentioned in their corresponding release notes: - https://developer.apple.com/documentation/xcode-release-notes/xcode-16_3-release-notes - https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.2 Resolves #722.
1 parent 54045e2 commit 0b0d7af

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _feature_compatibility(self):
119119
"compiler": {
120120
"gcc": "14",
121121
"clang": "18",
122-
"apple-clang": "",
122+
"apple-clang": "17",
123123
"msvc": "195",
124124
},
125125
},

docs/getting_started/cpp_compiler_support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ C++ feature:
1919
| **`std::format`** | 20 | 13+ | 17+ | 16+ | 194+ |
2020
| **C++ modules** | 20 | None | 17+ | None | None |
2121
| **`import std;`** | 23 | None | 18+ | None | None |
22-
| **Explicit `this` parameter** | 23 | 14+ | 18+ | None | 195+ |
22+
| **Explicit `this` parameter** | 23 | 14+ | 18+ | 17+ | 195+ |
2323

2424
??? note "clang-19 unfixable bug"
2525

src/CMakeLists.txt

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,25 @@ if(NOT ${projectPrefix}LIB_FORMAT_SUPPORTED AND ${projectPrefix}LIBCXX)
6565
endif()
6666
endif()
6767

68-
# clang++-18 supports explicit `this` parameter
69-
# https://github.com/llvm/llvm-project/issues/82780
7068
if(NOT ${projectPrefix}EXPLICIT_THIS_PARAMETER_SUPPORTED
7169
AND CMAKE_CXX_STANDARD GREATER_EQUAL 23
72-
AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
73-
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "18"
7470
)
75-
message(STATUS "Clang 18+ detected, overriding `no CRTP` support")
76-
set(${projectPrefix}EXPLICIT_THIS_PARAMETER_SUPPORTED ON)
71+
# clang++-18 supports explicit `this` parameter
72+
# https://github.com/llvm/llvm-project/issues/82780
73+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "18")
74+
message(STATUS "Clang 18+ detected, overriding `no CRTP` support")
75+
set(${projectPrefix}EXPLICIT_THIS_PARAMETER_SUPPORTED ON)
76+
# AppleClang 17 also supports explicit `this` parameter (feature check macro unimplemented)
77+
# https://developer.apple.com/documentation/xcode-release-notes/xcode-16_3-release-notes
78+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "17")
79+
message(STATUS "AppleClang 17+ detected, overriding `no CRTP` support")
80+
set(${projectPrefix}EXPLICIT_THIS_PARAMETER_SUPPORTED ON)
81+
# MSVC 19.32 also supports explicit `this` parameter (feature check macro unimplemented in this version)
82+
# https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.2
83+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "19.32")
84+
message(STATUS "MSVC 19.32+ detected, overriding `no CRTP` support")
85+
set(${projectPrefix}EXPLICIT_THIS_PARAMETER_SUPPORTED ON)
86+
endif()
7787
endif()
7888

7989
# project API settings

0 commit comments

Comments
 (0)