From 9ce9db25fa61823f62de7f171ea6a7415218726a Mon Sep 17 00:00:00 2001 From: Daniel Boles Date: Thu, 23 Nov 2023 22:14:35 +0000 Subject: [PATCH] slot|signal: static_assert not using R,T... syntax 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 https://github.com/libsigcplusplus/libsigcplusplus/issues/86 --- sigc++/functors/slot.h | 4 +++- sigc++/signal.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sigc++/functors/slot.h b/sigc++/functors/slot.h index 3f4b510..fc7f2af 100644 --- a/sigc++/functors/slot.h +++ b/sigc++/functors/slot.h @@ -194,7 +194,9 @@ struct slot_call */ #ifndef DOXYGEN_SHOULD_SKIP_THIS template -class slot; +class slot final { + static_assert(sizeof...(T_arg) < 0, "The slot syntax has been removed. Use the slot syntax."); +}; #endif // DOXYGEN_SHOULD_SKIP_THIS template diff --git a/sigc++/signal.h b/sigc++/signal.h index 2075bc3..675c1a0 100644 --- a/sigc++/signal.h +++ b/sigc++/signal.h @@ -581,7 +581,9 @@ class signal_with_accumulator : public signal_base */ #ifndef DOXYGEN_SHOULD_SKIP_THIS template -class signal; +class signal final { + static_assert(sizeof...(T_arg) < 0, "The signal syntax has been removed. Use the signal syntax."); +}; #endif // DOXYGEN_SHOULD_SKIP_THIS template