Skip to content

Commit 0e79f1a

Browse files
db-srckjellahl
authored andcommitted
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 #86
1 parent e62bf47 commit 0e79f1a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

sigc++/functors/slot.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ struct slot_call
194194
*/
195195
#ifndef DOXYGEN_SHOULD_SKIP_THIS
196196
template<typename T_return, typename... T_arg>
197-
class slot;
197+
class slot final {
198+
static_assert(sizeof...(T_arg) < 0, "The slot<R, T...> syntax has been removed. Use the slot<R(T...)> syntax.");
199+
};
198200
#endif // DOXYGEN_SHOULD_SKIP_THIS
199201

200202
template<typename T_return, typename... T_arg>

sigc++/signal.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,9 @@ class signal_with_accumulator : public signal_base
581581
*/
582582
#ifndef DOXYGEN_SHOULD_SKIP_THIS
583583
template<typename T_return, typename... T_arg>
584-
class signal;
584+
class signal final {
585+
static_assert(sizeof...(T_arg) < 0, "The signal<R, T...> syntax has been removed. Use the signal<R(T...)> syntax.");
586+
};
585587
#endif // DOXYGEN_SHOULD_SKIP_THIS
586588

587589
template<typename T_return, typename... T_arg>

0 commit comments

Comments
 (0)