Skip to content

Commit 8a1811e

Browse files
committed
Disable function::target if rtti is disabled
1 parent 03593ab commit 8a1811e

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

include/brisk/core/Binding.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,7 @@ static_assert(PropertyLike<Property<Dummy1, bool, &Dummy1::m_v>>);
17361736

17371737
class Object {
17381738
public:
1739-
virtual ~Object() noexcept {}
1739+
virtual ~Object() noexcept;
17401740
};
17411741

17421742
template <typename T>

include/brisk/core/internal/Function.hpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ template <typename R, typename... Args>
3333
struct fn_base {
3434
virtual ~fn_base() {}
3535

36-
virtual R operator()(Args... args) = 0;
36+
virtual R operator()(Args... args) = 0;
37+
#ifdef BRISK_RTTI
3738
virtual const std::type_info& target_type() const noexcept = 0;
3839
virtual void* target() noexcept = 0;
40+
#endif
3941
};
4042

4143
template <typename Fn, typename R, typename... Args>
@@ -49,13 +51,15 @@ struct fn_impl : public fn_base<R, Args...> {
4951
return fn(std::forward<Args>(args)...);
5052
}
5153

54+
#ifdef BRISK_RTTI
5255
const std::type_info& target_type() const noexcept override {
5356
return typeid(Fn);
5457
}
5558

5659
void* target() noexcept override {
5760
return &fn;
5861
}
62+
#endif
5963

6064
Fn fn;
6165
};
@@ -95,6 +99,7 @@ struct function<R(Args...)> {
9599

96100
std::shared_ptr<fn_base<R, Args...>> impl;
97101

102+
#ifdef BRISK_RTTI
98103
const std::type_info& target_type() const noexcept {
99104
return impl->target_type();
100105
}
@@ -107,6 +112,7 @@ struct function<R(Args...)> {
107112
return nullptr;
108113
}
109114
}
115+
#endif
110116

111117
bool operator==(const function& fn) const noexcept {
112118
return impl == fn.impl;

include/brisk/gui/WidgetTree.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Widget;
3535
struct WidgetGroup {
3636
std::vector<Widget*> widgets;
3737

38-
~WidgetGroup();
38+
virtual ~WidgetGroup();
3939

4040
virtual void beforeRefresh() {}
4141

src/core/Binding.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -270,4 +270,6 @@ void Bindings::internalDisconnect(const BindingAddresses& addresses, BindDir dir
270270
}
271271
}
272272
}
273+
274+
Object::~Object() noexcept {}
273275
} // namespace Brisk

0 commit comments

Comments
 (0)