Browse Source

fixed typo + added tests (thanks to Kerndog73)

Michele Caini 7 years ago
parent
commit
f558126854
2 changed files with 3 additions and 2 deletions
  1. 1 1
      src/entt/signal/delegate.hpp
  2. 2 1
      test/entt/signal/delegate.cpp

+ 1 - 1
src/entt/signal/delegate.hpp

@@ -191,7 +191,7 @@ public:
      */
     template<typename Invokable>
     void connect(Invokable invokable) ENTT_NOEXCEPT {
-        static_assert(sizeof(Invokable) < sizeof(void *));
+        static_assert(sizeof(Invokable) <= sizeof(void *));
         static_assert(std::is_class_v<Invokable>);
         static_assert(std::is_trivially_destructible_v<Invokable>);
         static_assert(std::is_invocable_r_v<Ret, Invokable, Args...>);

+ 2 - 1
test/entt/signal/delegate.cpp

@@ -85,9 +85,10 @@ TEST(Delegate, LambdaAndFunctor) {
     entt::delegate<int(int)> non_capturing_delegate;
     entt::delegate<int(int)> capturing_delegate;
     entt::delegate<int(int)> functor_delegate;
+    const int value = 5;
 
     non_capturing_delegate.connect([](int v) { return v*v; });
-    capturing_delegate.connect([value = 5](int v) { return v*value; });
+    capturing_delegate.connect([val = &value](int v) { return v * *val; });
     functor_delegate.connect(delegate_functor{});
 
     ASSERT_EQ(non_capturing_delegate(3), 9);