@@ -358,22 +358,27 @@ class BehaviorTreeFactory
358358 template <typename T, typename ... ExtraArgs>
359359 void registerNodeType (const std::string& ID, ExtraArgs... args)
360360 {
361- // check first if the given class is abstract
362- static_assert (!std::is_abstract_v<T>, " The given type can't be abstract" );
363-
364- constexpr bool param_constructable =
365- std::is_constructible<T, const std::string&, const NodeConfig&, ExtraArgs...>::value;
366- constexpr bool has_static_ports_list = has_static_method_providedPorts<T>::value;
367-
368- // clang-format off
369- static_assert (!(param_constructable && !has_static_ports_list),
370- " [registerNode]: you MUST implement the static method:\n "
371- " PortsList providedPorts();\n " );
372-
373- static_assert (!(has_static_ports_list && !param_constructable),
374- " [registerNode]: since you have a static method providedPorts(),\n "
375- " you MUST add a constructor with signature:\n "
376- " (const std::string&, const NodeParameters&)\n " );
361+ if constexpr (std::is_abstract_v<T>) {
362+ // check first if the given class is abstract
363+ static_assert (!std::is_abstract_v<T>, " The Node type can't be abstract. "
364+ " Did you forget to implement an abstract "
365+ " method in the derived class?" );
366+ }
367+ else {
368+ constexpr bool param_constructable =
369+ std::is_constructible<T, const std::string&, const NodeConfig&, ExtraArgs...>::value;
370+ constexpr bool has_static_ports_list = has_static_method_providedPorts<T>::value;
371+
372+ // clang-format off
373+ static_assert (!(param_constructable && !has_static_ports_list),
374+ " [registerNode]: you MUST implement the static method:\n "
375+ " PortsList providedPorts();\n " );
376+
377+ static_assert (!(has_static_ports_list && !param_constructable),
378+ " [registerNode]: since you have a static method providedPorts(),\n "
379+ " you MUST add a constructor with signature:\n "
380+ " (const std::string&, const NodeConfig&)\n " );
381+ }
377382 // clang-format on
378383 registerNodeType<T>(ID, getProvidedPorts<T>(), args...);
379384 }
0 commit comments