We currently do not support passing user-defined types in event handler declaration in the EVT file. If one does that, this fails at JIT time with intransparent C++ compiler errors. We should instead reject this explicitly.
$ spicyz foo.spicy foo.evt -o foo.hlto
/tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc: In function ‘void __hlt::spicy_hooks_foo::__hook_X___on_0x25_done_6042(hilti::rt::ValueReference<__hlt::foo::X>&)’:
/tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:162:400: error: no matching function for call to ‘to_val(hilti::rt::ValueReference<__hlt::foo::Y>&, zeek::TypePtr, std::string)’
162 | args.emplace_back(spicy::zeek::rt::to_val(::hilti::rt::optional::value((*__self).y, "/workspaces/zeek-playground/re2/foo.evt:7:1"), spicy::zeek::rt::event_arg_type(spicy_hooks_foo::__globals()->__zeek_handler_foo_X_582c4c7796f6bd3c, ::hilti::rt::integer::safe<std::uint64_t>{1U}, std::string("/workspaces/zeek-playground/re2/foo.evt:7")), std::string("/workspaces/zeek-playground/re2/foo.evt:7")));
| ^
In file included from /tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:8:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:602:23: note: candidate: ‘template<class T, std::enable_if_t<hilti::rt::is_tuple< <template-parameter-1-1> >::value>* <anonymous> > zeek::ValPtr spicy::zeek::rt::to_val(const T&, zeek::TypePtr, const string&)’
602 | inline ::zeek::ValPtr to_val(const T& t, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:602:23: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/bits/char_traits.h:39,
from /usr/include/c++/10/string:40,
from /opt/zeek/include/hilti/rt/autogen/config.h:5,
from /opt/zeek/include/hilti/rt/libhilti.h:9,
from /tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:6:
/usr/include/c++/10/type_traits: In substitution of ‘template<bool _Cond, class _Tp> using enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:330:82: required from here
/usr/include/c++/10/type_traits:2554:11: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
2554 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
In file included from /tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:8:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:644:23: note: candidate: ‘template<class T, std::enable_if_t<std::is_base_of<hilti::rt::trait::isStruct, T>::value>* <anonymous> > zeek::ValPtr spicy::zeek::rt::to_val(const T&, zeek::TypePtr, const string&)’
644 | inline ::zeek::ValPtr to_val(const T& t, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:644:23: note: template argument deduction/substitution failed:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:701:23: note: candidate: ‘template<class T, std::enable_if_t<std::is_enum<_Tp>::value>* <anonymous> > zeek::ValPtr spicy::zeek::rt::to_val(const T&, zeek::TypePtr, const string&)’
701 | inline ::zeek::ValPtr to_val(const T& t, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:701:23: note: template argument deduction/substitution failed:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:542:23: note: candidate: ‘template<class K, class V> zeek::ValPtr spicy::zeek::rt::to_val(const hilti::rt::Map<K, V>&, zeek::TypePtr, const string&)’
542 | inline ::zeek::ValPtr to_val(const hilti::rt::Map<K, V>& m, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:542:23: note: template argument deduction/substitution failed:
/tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:162:400: note: ‘hilti::rt::ValueReference<__hlt::foo::Y>’ is not derived from ‘const hilti::rt::Map<K, V>’
162 | args.emplace_back(spicy::zeek::rt::to_val(::hilti::rt::optional::value((*__self).y, "/workspaces/zeek-playground/re2/foo.evt:7:1"), spicy::zeek::rt::event_arg_type(spicy_hooks_foo::__globals()->__zeek_handler_foo_X_582c4c7796f6bd3c, ::hilti::rt::integer::safe<std::uint64_t>{1U}, std::string("/workspaces/zeek-playground/re2/foo.evt:7")), std::string("/workspaces/zeek-playground/re2/foo.evt:7")));
| ^
In file included from /tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:8:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:572:23: note: candidate: ‘template<class T> zeek::ValPtr spicy::zeek::rt::to_val(const hilti::rt::Set<T>&, zeek::TypePtr, const string&)’
572 | inline ::zeek::ValPtr to_val(const hilti::rt::Set<T>& s, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:572:23: note: template argument deduction/substitution failed:
/tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:162:400: note: ‘hilti::rt::ValueReference<__hlt::foo::Y>’ is not derived from ‘const hilti::rt::Set<T>’
162 | args.emplace_back(spicy::zeek::rt::to_val(::hilti::rt::optional::value((*__self).y, "/workspaces/zeek-playground/re2/foo.evt:7:1"), spicy::zeek::rt::event_arg_type(spicy_hooks_foo::__globals()->__zeek_handler_foo_X_582c4c7796f6bd3c, ::hilti::rt::integer::safe<std::uint64_t>{1U}, std::string("/workspaces/zeek-playground/re2/foo.evt:7")), std::string("/workspaces/zeek-playground/re2/foo.evt:7")));
| ^
In file included from /tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:8:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:525:23: note: candidate: ‘template<class T> zeek::ValPtr spicy::zeek::rt::to_val(const hilti::rt::Vector<T>&, zeek::TypePtr, const string&)’
525 | inline ::zeek::ValPtr to_val(const hilti::rt::Vector<T>& v, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:525:23: note: template argument deduction/substitution failed:
/tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:162:400: note: ‘hilti::rt::ValueReference<__hlt::foo::Y>’ is not derived from ‘const hilti::rt::Vector<T>’
162 | args.emplace_back(spicy::zeek::rt::to_val(::hilti::rt::optional::value((*__self).y, "/workspaces/zeek-playground/re2/foo.evt:7:1"), spicy::zeek::rt::event_arg_type(spicy_hooks_foo::__globals()->__zeek_handler_foo_X_582c4c7796f6bd3c, ::hilti::rt::integer::safe<std::uint64_t>{1U}, std::string("/workspaces/zeek-playground/re2/foo.evt:7")), std::string("/workspaces/zeek-playground/re2/foo.evt:7")));
| ^
In file included from /tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:8:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:364:23: note: candidate: ‘template<class T> zeek::ValPtr spicy::zeek::rt::to_val(const std::optional<_Tp>&, zeek::TypePtr, const string&)’
364 | inline ::zeek::ValPtr to_val(const std::optional<T>& t, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:364:23: note: template argument deduction/substitution failed:
/tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:162:400: note: ‘hilti::rt::ValueReference<__hlt::foo::Y>’ is not derived from ‘const std::optional<_Tp>’
162 | args.emplace_back(spicy::zeek::rt::to_val(::hilti::rt::optional::value((*__self).y, "/workspaces/zeek-playground/re2/foo.evt:7:1"), spicy::zeek::rt::event_arg_type(spicy_hooks_foo::__globals()->__zeek_handler_foo_X_582c4c7796f6bd3c, ::hilti::rt::integer::safe<std::uint64_t>{1U}, std::string("/workspaces/zeek-playground/re2/foo.evt:7")), std::string("/workspaces/zeek-playground/re2/foo.evt:7")));
| ^
In file included from /tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:8:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:378:23: note: candidate: ‘template<class T> zeek::ValPtr spicy::zeek::rt::to_val(const hilti::rt::DeferredExpression<Result>&, zeek::TypePtr, const string&)’
378 | inline ::zeek::ValPtr to_val(const hilti::rt::DeferredExpression<T>& t, ::zeek::TypePtr target,
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:378:23: note: template argument deduction/substitution failed:
/tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:162:400: note: ‘hilti::rt::ValueReference<__hlt::foo::Y>’ is not derived from ‘const hilti::rt::DeferredExpression<Result>’
162 | args.emplace_back(spicy::zeek::rt::to_val(::hilti::rt::optional::value((*__self).y, "/workspaces/zeek-playground/re2/foo.evt:7:1"), spicy::zeek::rt::event_arg_type(spicy_hooks_foo::__globals()->__zeek_handler_foo_X_582c4c7796f6bd3c, ::hilti::rt::integer::safe<std::uint64_t>{1U}, std::string("/workspaces/zeek-playground/re2/foo.evt:7")), std::string("/workspaces/zeek-playground/re2/foo.evt:7")));
| ^
In file included from /tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:8:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:414:23: note: candidate: ‘template<class T> zeek::ValPtr spicy::zeek::rt::to_val(hilti::rt::integer::safe<T>, zeek::TypePtr, const string&)’
414 | inline ::zeek::ValPtr to_val(hilti::rt::integer::safe<T> i, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:414:23: note: template argument deduction/substitution failed:
/tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:162:400: note: ‘hilti::rt::ValueReference<__hlt::foo::Y>’ is not derived from ‘SafeInt<T, hilti::rt::integer::detail::SafeIntException>’
162 | args.emplace_back(spicy::zeek::rt::to_val(::hilti::rt::optional::value((*__self).y, "/workspaces/zeek-playground/re2/foo.evt:7:1"), spicy::zeek::rt::event_arg_type(spicy_hooks_foo::__globals()->__zeek_handler_foo_X_582c4c7796f6bd3c, ::hilti::rt::integer::safe<std::uint64_t>{1U}, std::string("/workspaces/zeek-playground/re2/foo.evt:7")), std::string("/workspaces/zeek-playground/re2/foo.evt:7")));
| ^
In file included from /tmp/spicy_hooks_foo_7c2b98512c2cb89c-48ee19717edfa961.cc:8:
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:444:23: note: candidate: ‘zeek::ValPtr spicy::zeek::rt::to_val(const hilti::rt::Bool&, zeek::TypePtr, const string&)’
444 | inline ::zeek::ValPtr to_val(const hilti::rt::Bool& b, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:444:53: note: no known conversion for argument 1 from ‘hilti::rt::ValueReference<__hlt::foo::Y>’ to ‘const hilti::rt::Bool&’
444 | inline ::zeek::ValPtr to_val(const hilti::rt::Bool& b, ::zeek::TypePtr target, const std::string& location) {
| ~~~~~~~~~~~~~~~~~~~~~~~^
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:466:23: note: candidate: ‘zeek::ValPtr spicy::zeek::rt::to_val(const hilti::rt::Address&, zeek::TypePtr, const string&)’
466 | inline ::zeek::ValPtr to_val(const hilti::rt::Address& d, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:466:56: note: no known conversion for argument 1 from ‘hilti::rt::ValueReference<__hlt::foo::Y>’ to ‘const hilti::rt::Address&’
466 | inline ::zeek::ValPtr to_val(const hilti::rt::Address& d, ::zeek::TypePtr target, const std::string& location) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:402:23: note: candidate: ‘zeek::ValPtr spicy::zeek::rt::to_val(const hilti::rt::Bytes&, zeek::TypePtr, const string&)’
402 | inline ::zeek::ValPtr to_val(const hilti::rt::Bytes& b, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:402:54: note: no known conversion for argument 1 from ‘hilti::rt::ValueReference<__hlt::foo::Y>’ to ‘const hilti::rt::Bytes&’
402 | inline ::zeek::ValPtr to_val(const hilti::rt::Bytes& b, ::zeek::TypePtr target, const std::string& location) {
| ~~~~~~~~~~~~~~~~~~~~~~~~^
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:502:23: note: candidate: ‘zeek::ValPtr spicy::zeek::rt::to_val(const hilti::rt::Interval&, zeek::TypePtr, const string&)’
502 | inline ::zeek::ValPtr to_val(const hilti::rt::Interval& i, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:502:57: note: no known conversion for argument 1 from ‘hilti::rt::ValueReference<__hlt::foo::Y>’ to ‘const hilti::rt::Interval&’
502 | inline ::zeek::ValPtr to_val(const hilti::rt::Interval& i, ::zeek::TypePtr target, const std::string& location) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:483:23: note: candidate: ‘zeek::ValPtr spicy::zeek::rt::to_val(const hilti::rt::Port&, zeek::TypePtr, const string&)’
483 | inline ::zeek::ValPtr to_val(const hilti::rt::Port& p, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:483:53: note: no known conversion for argument 1 from ‘hilti::rt::ValueReference<__hlt::foo::Y>’ to ‘const hilti::rt::Port&’
483 | inline ::zeek::ValPtr to_val(const hilti::rt::Port& p, ::zeek::TypePtr target, const std::string& location) {
| ~~~~~~~~~~~~~~~~~~~~~~~^
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:513:23: note: candidate: ‘zeek::ValPtr spicy::zeek::rt::to_val(const hilti::rt::Time&, zeek::TypePtr, const string&)’
513 | inline ::zeek::ValPtr to_val(const hilti::rt::Time& t, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:513:53: note: no known conversion for argument 1 from ‘hilti::rt::ValueReference<__hlt::foo::Y>’ to ‘const hilti::rt::Time&’
513 | inline ::zeek::ValPtr to_val(const hilti::rt::Time& t, ::zeek::TypePtr target, const std::string& location) {
| ~~~~~~~~~~~~~~~~~~~~~~~^
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:391:23: note: candidate: ‘zeek::ValPtr spicy::zeek::rt::to_val(const string&, zeek::TypePtr, const string&)’
391 | inline ::zeek::ValPtr to_val(const std::string& s, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:391:49: note: no known conversion for argument 1 from ‘hilti::rt::ValueReference<__hlt::foo::Y>’ to ‘const string&’ {aka ‘const std::__cxx11::basic_string<char>&’}
391 | inline ::zeek::ValPtr to_val(const std::string& s, ::zeek::TypePtr target, const std::string& location) {
| ~~~~~~~~~~~~~~~~~~~^
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:455:23: note: candidate: ‘zeek::ValPtr spicy::zeek::rt::to_val(double, zeek::TypePtr, const string&)’
455 | inline ::zeek::ValPtr to_val(double r, ::zeek::TypePtr target, const std::string& location) {
| ^~~~~~
/opt/zeek/lib/zeek-spicy/include/zeek-spicy/runtime-support.h:455:37: note: no known conversion for argument 1 from ‘hilti::rt::ValueReference<__hlt::foo::Y>’ to ‘double’
455 | inline ::zeek::ValPtr to_val(double r, ::zeek::TypePtr target, const std::string& location) {
| ~~~~~~~^
[error] <Spicy Plugin for Zeek>: JIT compilation failed