Skip to content

fix: prevent ambiguous call by calling signal handler with std::nullopt - #541

Merged
sangelovic merged 4 commits into
Kistler-Group:masterfrom
ofacklam:bugfix/signal-with-error-param
Jun 8, 2026
Merged

sangelovic merged 4 commits into
Kistler-Group:masterfrom
ofacklam:bugfix/signal-with-error-param

Conversation

@ofacklam

Copy link
Copy Markdown
Contributor

This fixes the following compilation error:

/sdbus-cpp/include/sdbus-c++/ConvenienceApiClasses.inl:465:29: error: call of overloaded ‘apply(const sdbus::test::TestProxy::TestProxy(sdbus::IConnection&, sdbus::ServiceName, sdbus::ObjectPath)::<lambda(std::optional<sdbus::Error>, int)>&, <brace-enclosed initializer list>, sdbus::tuple_of_function_input_arg_types_t<sdbus::test::TestProxy::TestProxy(sdbus::IConnection&, sdbus::ServiceName, sdbus::ObjectPath)::<lambda(std::optional<sdbus::Error>, int)> >&)’ is ambiguous
  465 |                 sdbus::apply(callback, {}, signalArgs);
      |                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/sdbus-cpp/include/sdbus-c++/TypeTraits.h:682:30: note: candidate: ‘constexpr decltype(auto) sdbus::apply(Function&&, Result<Args ...>&&, Tuple&&) [with Function = const test::TestProxy::TestProxy(sdbus::IConnection&, sdbus::ServiceName, sdbus::ObjectPath)::<lambda(std::optional<Error>, int)>&; Tuple = std::tuple<int>&; Args = {}]’
  682 |     constexpr decltype(auto) apply(Function&& fun, Result<Args...>&& res, Tuple&& tuple)
      |                              ^~~~~
/sdbus-cpp/include/sdbus-c++/TypeTraits.h:693:20: note: candidate: ‘decltype(auto) sdbus::apply(Function&&, std::optional<Error>, Tuple&&) [with Function = const test::TestProxy::TestProxy(sdbus::IConnection&, sdbus::ServiceName, sdbus::ObjectPath)::<lambda(std::optional<Error>, int)>&; Tuple = std::tuple<int>&]’
  693 |     decltype(auto) apply(Function&& fun, std::optional<Error> err, Tuple&& tuple)
      |                    ^~~~~

ofacklam and others added 3 commits May 27, 2026 18:37
This fixes the following compilation error:
```cpp
/sdbus-cpp/include/sdbus-c++/ConvenienceApiClasses.inl:465:29: error: call of overloaded ‘apply(const sdbus::test::TestProxy::TestProxy(sdbus::IConnection&, sdbus::ServiceName, sdbus::ObjectPath)::<lambda(std::optional<sdbus::Error>, int)>&, <brace-enclosed initializer list>, sdbus::tuple_of_function_input_arg_types_t<sdbus::test::TestProxy::TestProxy(sdbus::IConnection&, sdbus::ServiceName, sdbus::ObjectPath)::<lambda(std::optional<sdbus::Error>, int)> >&)’ is ambiguous
  465 |                 sdbus::apply(callback, {}, signalArgs);
      |                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/sdbus-cpp/include/sdbus-c++/TypeTraits.h:682:30: note: candidate: ‘constexpr decltype(auto) sdbus::apply(Function&&, Result<Args ...>&&, Tuple&&) [with Function = const test::TestProxy::TestProxy(sdbus::IConnection&, sdbus::ServiceName, sdbus::ObjectPath)::<lambda(std::optional<Error>, int)>&; Tuple = std::tuple<int>&; Args = {}]’
  682 |     constexpr decltype(auto) apply(Function&& fun, Result<Args...>&& res, Tuple&& tuple)
      |                              ^~~~~
/sdbus-cpp/include/sdbus-c++/TypeTraits.h:693:20: note: candidate: ‘decltype(auto) sdbus::apply(Function&&, std::optional<Error>, Tuple&&) [with Function = const test::TestProxy::TestProxy(sdbus::IConnection&, sdbus::ServiceName, sdbus::ObjectPath)::<lambda(std::optional<Error>, int)>&; Tuple = std::tuple<int>&]’
  693 |     decltype(auto) apply(Function&& fun, std::optional<Error> err, Tuple&& tuple)
      |                    ^~~~~
```
@sangelovic

Copy link
Copy Markdown
Collaborator

Good catch. Thanks for fixing this, and for adding the corresponding test case, @ofacklam

@sangelovic
sangelovic force-pushed the bugfix/signal-with-error-param branch from a8c017d to 3bc9f96 Compare June 8, 2026 18:07
@sangelovic
sangelovic merged commit 0b9b15c into Kistler-Group:master Jun 8, 2026
10 checks passed
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.

2 participants