Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: check for P2582R1 support #2446

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,14 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-Wno-error=deprecated-declarations)
endif ()

if (CMAKE_CXX_STANDARD GREATER_EQUAL 23)
include (CheckP2582R1)
if (Cxx_Compiler_IMPLEMENTS_P2581R1)
target_compile_definitions (seastar
PUBLIC SEASTAR_P2581R1)
endif ()
endif ()

if (BUILD_SHARED_LIBS)
# use initial-exec TLS, as it puts the TLS variables in the static TLS space
# instead of allocating them using malloc. otherwise intercepting mallocs and
Expand Down
26 changes: 26 additions & 0 deletions cmake/CheckP2582R1.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
include (CheckCXXSourceCompiles)
include (CMakePushCheckState)

cmake_push_check_state (RESET)

set (CMAKE_REQUIRED_FLAGS "-std=c++23")

# check if the compiler implements the inherited vs non-inherited guide
# tiebreaker specified by P2582R1, see https://wg21.link/P2582R1
check_cxx_source_compiles ("
template <typename T> struct B {
B(T) {}
};

template <typename T> struct C : public B<T> {
using B<T>::B;
};

B(int) -> B<char>;
C c2(42);

int main() {}
"
Cxx_Compiler_IMPLEMENTS_P2581R1)

cmake_pop_check_state ()
2 changes: 2 additions & 0 deletions include/seastar/rpc/rpc_types.hh
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,10 @@ public:

/// @}

#ifndef SEASTAR_P2581R1
template <typename... T>
tuple(T&&...) -> tuple<T...>;
#endif

} // namespace rpc

Expand Down