Skip to content

Commit 58d8eec

Browse files
committed
fixed -Wlifetime-safety-intra-tu-suggestions Clang warning
1 parent c4b3df0 commit 58d8eec

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
7373
add_compile_options_safe(-Wno-thread-safety-negative)
7474
add_compile_options_safe(-Wno-thread-safety-beta)
7575

76-
# TODO: enable
77-
add_compile_options_safe(-Wno-lifetime-safety-intra-tu-suggestions)
76+
# TODO: check for proper AppleClang version
77+
# we do not add the annotation until C++20
78+
# the warnings were introduced with Clang 23
79+
if(CMAKE_CXX_STANDARD LESS 20)
80+
add_compile_options_safe(-Wno-lifetime-safety-intra-tu-suggestions)
81+
endif()
7882
add_compile_options_safe(-Wno-lifetime-safety-intra-tu-constructor-suggestions)
7983
add_compile_options_safe(-Wno-lifetime-safety-cross-tu-constructor-suggestions)
8084

@@ -88,6 +92,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
8892
# we are not interested in these
8993
set_source_files_properties(test.cpp PROPERTIES COMPILE_FLAGS "-Wno-multichar -Wno-four-char-constants")
9094

95+
# TODO: check for proper AppleClang version
9196
if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 14 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 14)
9297
# TODO: verify this regression still exists in clang-15
9398
if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")

0 commit comments

Comments
 (0)