Skip to content

Possible Operator Usage/Deduction Error when Using REGISTER_STRUCT macros #458

Closed Answered by sangelovic
fwilmsh asked this question in Q&A
Discussion options

You must be logged in to vote

@fwilmsh Here is the likely explanation to your issue:

To find the correct operator<< implementation, the compiler involves unqualified name lookup (UNL) as well as argument dependent lookup (ADL) when building the set of candidates for overloaded operator resolution:

  1. In case of Bar registration, the SDBUSCPP_REGISTER_STRUCT macro calls sdbus::detail::serialize_pack() method which calls operator<< for all struct members. So from the context of sdbus::detail::serialize_pack(), when resolving operator<<() for std::optional<Foo> the compiler finds these candidates:

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by fwilmsh
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #456 on October 07, 2024 18:03.