From: Kefu Chai Date: Wed, 9 Jul 2025 05:16:36 +0000 (+0800) Subject: cmake: upgrade CMAKE_CXX_STANDARD from 20 to 23 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=36badc97ae95c154824cc0ff3335caabdea00ad8;p=ceph.git cmake: upgrade CMAKE_CXX_STANDARD from 20 to 23 Adopt C++23 to leverage new standard library features and reduce dependencies on third-party implementations: Standard library improvements: - std::expected<> replaces third-party implementation at src/include/expected.hpp - std::flat_map/std::flat_set replace boost alternatives - std::stacktrace replaces homebrew implementation at src/common/BackTrace.h Language improvements: - Deducing this enables elimination of code duplication Benefits: - Reduced maintenance overhead - Fewer third-party dependencies - Simplified codebase This upgrade is supported by our migration to clang-19 (0e5a51b6) and libstdc++ from GCC-11, which provide sufficient C++23 feature coverage for our needs. Signed-off-by: Kefu Chai --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fc5b03e93564d..88fd41b964041 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -241,8 +241,8 @@ if(HAVE_INTEL) endif() endif() -# require c++20 -set(CMAKE_CXX_STANDARD 20) +# require c++23 +set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD 99)