Skip to content

Commit

Permalink
slot|signal: static_assert not using R,T... syntax
Browse files Browse the repository at this point in the history
This can lead to clearer errors by explaining the user's error, not just
saying they used an incomplete type (why is it incomplete?). I don't use
only static_assert(false) because that's ill-formed before C++23, AFAIK,
& even if it's OK in some cases I don't grok which... so hope this works

libsigcplusplus#86
  • Loading branch information
db-src committed Nov 23, 2023
1 parent eb7db8e commit 9ce9db2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion sigc++/functors/slot.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ struct slot_call
*/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template<typename T_return, typename... T_arg>
class slot;
class slot final {
static_assert(sizeof...(T_arg) < 0, "The slot<R, T...> syntax has been removed. Use the slot<R(T...)> syntax.");
};
#endif // DOXYGEN_SHOULD_SKIP_THIS

template<typename T_return, typename... T_arg>
Expand Down
4 changes: 3 additions & 1 deletion sigc++/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,9 @@ class signal_with_accumulator : public signal_base
*/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template<typename T_return, typename... T_arg>
class signal;
class signal final {
static_assert(sizeof...(T_arg) < 0, "The signal<R, T...> syntax has been removed. Use the signal<R(T...)> syntax.");
};
#endif // DOXYGEN_SHOULD_SKIP_THIS

template<typename T_return, typename... T_arg>
Expand Down

0 comments on commit 9ce9db2

Please sign in to comment.