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: fix P2582R1 detection in GCC compatibility check #2659

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tchaikov
Copy link
Contributor

The current P2582R1 support detection fails with GCC 14.2.0 (Ubuntu) and 14.2.1 (Fedora) because these compilers don't properly handle parameter packs during argument deduction, which is a key part of P2582R1.

Update CheckP2582R1.cmake to use a constructor with parameter packs in its test case, which more accurately reflects P2582R1's requirements. This allows the check to correctly identify incomplete P2582R1 support in:

  • GCC 14.2.0 on Ubuntu Oracular
  • GCC 14.2.1 on Fedora 41

The previous test was producing false positives, leading to build failures in the RPC tests where tuple argument deduction was attempted.

For the build failure with GCC (Ubuntu 14.2.0-4ubuntu2) packaged for Ubuntu:Oracular:

/seastar/tests/unit/rpc_test.cc: In lambda function:
/seastar/tests/unit/rpc_test.cc:1369:89: error: class template argument deduction failed:
 1369 |             return make_ready_future<rpc::tuple<int, long>>(rpc::tuple(1, 0x7'0000'0000L));
      |                                                                                         ^
/seastar/tests/unit/rpc_test.cc:1369:89: error: no matching function for call to 'tuple(int, long int)'
In file included from /seastar/include/seastar/rpc/rpc.hh:36,
                 from /seastar/tests/unit/rpc_test.cc:25:
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note: candidate: 'template<class ... T> tuple(std::tuple<_Ts ...>&&)-> seastar::rpc::tuple<T>'
  401 |     tuple(std::tuple<T...>&& x) : std::tuple<T...>(std::move(x)) {}
      |     ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note:   candidate expects 1 argument, 2 provided
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note: candidate: 'template<class ... T> tuple(seastar::rpc::tuple<T>)-> seastar::rpc::tuple<T>'
  398 | class tuple : public std::tuple<T...> {
      |       ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note:   candidate expects 1 argument, 2 provided
/seastar/tests/unit/rpc_test.cc: At global scope:
/seastar/tests/unit/rpc_test.cc:1567:56: error: class template argument deduction failed:
 1567 | static_assert(std::is_same_v<decltype(rpc::tuple(1U, 1L)), rpc::tuple<unsigned, long>>, "rpc::tuple deduction guid not working");
      |                                                        ^
/seastar/tests/unit/rpc_test.cc:1567:56: error: no matching function for call to 'tuple(unsigned int, long int)'
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note: candidate: 'template<class ... T> tuple(std::tuple<_Ts ...>&&)-> seastar::rpc::tuple<T>'
  401 |     tuple(std::tuple<T...>&& x) : std::tuple<T...>(std::move(x)) {}
      |     ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note:   candidate expects 1 argument, 2 provided
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note: candidate: 'template<class ... T> tuple(seastar::rpc::tuple<T>)-> seastar::rpc::tuple<T>'
  398 | class tuple : public std::tuple<T...> {
      |       ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note:   candidate expects 1 argument, 2 provided
/seastar/tests/unit/rpc_test.cc:1567:56: error: class template argument deduction failed:
 1567 | static_assert(std::is_same_v<decltype(rpc::tuple(1U, 1L)), rpc::tuple<unsigned, long>>, "rpc::tuple deduction guid not working");
      |                                                        ^
/seastar/tests/unit/rpc_test.cc:1567:56: error: no matching function for call to 'tuple(unsigned int, long int)'
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note: candidate: 'template<class ... T> tuple(std::tuple<_Ts ...>&&)-> seastar::rpc::tuple<T>'
  401 |     tuple(std::tuple<T...>&& x) : std::tuple<T...>(std::move(x)) {}
      |     ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note:   candidate expects 1 argument, 2 provided
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note: candidate: 'template<class ... T> tuple(seastar::rpc::tuple<T>)-> seastar::rpc::tuple<T>'
  398 | class tuple : public std::tuple<T...> {
      |       ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note:   candidate expects 1 argument, 2 provided
/seastar/tests/unit/rpc_test.cc:1567:85: error: template argument 1 is invalid
 1567 | static_assert(std::is_same_v<decltype(rpc::tuple(1U, 1L)), rpc::tuple<unsigned, long>>, "rpc::tuple deduction guid not working");
      |                                                                                     ^~
In file included from /seastar/include/seastar/core/scheduling.hh:31,
                 from /seastar/include/seastar/core/task.hh:24,
                 from /seastar/include/seastar/core/future.hh:36,
                 from /seastar/include/seastar/core/iostream.hh:38,
                 from /seastar/tests/unit/loopback_socket.hh:26,
                 from /seastar/tests/unit/rpc_test.cc:22:

Refs #2445

The current P2582R1 support detection fails with GCC 14.2.0 (Ubuntu) and
14.2.1 (Fedora) because these compilers don't properly handle parameter
packs during argument deduction, which is a key part of P2582R1.

Update CheckP2582R1.cmake to use a constructor with parameter packs in its
test case, which more accurately reflects P2582R1's requirements. This
allows the check to correctly identify incomplete P2582R1 support in:
- GCC 14.2.0 on Ubuntu Oracular
- GCC 14.2.1 on Fedora 41

The previous test was producing false positives, leading to build failures
in the RPC tests where tuple argument deduction was attempted.

For the build failure with GCC (Ubuntu 14.2.0-4ubuntu2) packaged for
Ubuntu:Oracular:

```
/seastar/tests/unit/rpc_test.cc: In lambda function:
/seastar/tests/unit/rpc_test.cc:1369:89: error: class template argument deduction failed:
 1369 |             return make_ready_future<rpc::tuple<int, long>>(rpc::tuple(1, 0x7'0000'0000L));
      |                                                                                         ^
/seastar/tests/unit/rpc_test.cc:1369:89: error: no matching function for call to 'tuple(int, long int)'
In file included from /seastar/include/seastar/rpc/rpc.hh:36,
                 from /seastar/tests/unit/rpc_test.cc:25:
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note: candidate: 'template<class ... T> tuple(std::tuple<_Ts ...>&&)-> seastar::rpc::tuple<T>'
  401 |     tuple(std::tuple<T...>&& x) : std::tuple<T...>(std::move(x)) {}
      |     ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note:   candidate expects 1 argument, 2 provided
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note: candidate: 'template<class ... T> tuple(seastar::rpc::tuple<T>)-> seastar::rpc::tuple<T>'
  398 | class tuple : public std::tuple<T...> {
      |       ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note:   candidate expects 1 argument, 2 provided
/seastar/tests/unit/rpc_test.cc: At global scope:
/seastar/tests/unit/rpc_test.cc:1567:56: error: class template argument deduction failed:
 1567 | static_assert(std::is_same_v<decltype(rpc::tuple(1U, 1L)), rpc::tuple<unsigned, long>>, "rpc::tuple deduction guid not working");
      |                                                        ^
/seastar/tests/unit/rpc_test.cc:1567:56: error: no matching function for call to 'tuple(unsigned int, long int)'
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note: candidate: 'template<class ... T> tuple(std::tuple<_Ts ...>&&)-> seastar::rpc::tuple<T>'
  401 |     tuple(std::tuple<T...>&& x) : std::tuple<T...>(std::move(x)) {}
      |     ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note:   candidate expects 1 argument, 2 provided
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note: candidate: 'template<class ... T> tuple(seastar::rpc::tuple<T>)-> seastar::rpc::tuple<T>'
  398 | class tuple : public std::tuple<T...> {
      |       ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note:   candidate expects 1 argument, 2 provided
/seastar/tests/unit/rpc_test.cc:1567:56: error: class template argument deduction failed:
 1567 | static_assert(std::is_same_v<decltype(rpc::tuple(1U, 1L)), rpc::tuple<unsigned, long>>, "rpc::tuple deduction guid not working");
      |                                                        ^
/seastar/tests/unit/rpc_test.cc:1567:56: error: no matching function for call to 'tuple(unsigned int, long int)'
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note: candidate: 'template<class ... T> tuple(std::tuple<_Ts ...>&&)-> seastar::rpc::tuple<T>'
  401 |     tuple(std::tuple<T...>&& x) : std::tuple<T...>(std::move(x)) {}
      |     ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:401:5: note:   candidate expects 1 argument, 2 provided
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note: candidate: 'template<class ... T> tuple(seastar::rpc::tuple<T>)-> seastar::rpc::tuple<T>'
  398 | class tuple : public std::tuple<T...> {
      |       ^~~~~
/seastar/include/seastar/rpc/rpc_types.hh:398:7: note:   candidate expects 1 argument, 2 provided
/seastar/tests/unit/rpc_test.cc:1567:85: error: template argument 1 is invalid
 1567 | static_assert(std::is_same_v<decltype(rpc::tuple(1U, 1L)), rpc::tuple<unsigned, long>>, "rpc::tuple deduction guid not working");
      |                                                                                     ^~
In file included from /seastar/include/seastar/core/scheduling.hh:31,
                 from /seastar/include/seastar/core/task.hh:24,
                 from /seastar/include/seastar/core/future.hh:36,
                 from /seastar/include/seastar/core/iostream.hh:38,
                 from /seastar/tests/unit/loopback_socket.hh:26,
                 from /seastar/tests/unit/rpc_test.cc:22:
```

Refs scylladb#2445

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov tchaikov marked this pull request as ready for review February 24, 2025 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant