danielaparker / jsoncons

A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON
https://danielaparker.github.io/jsoncons
Other
697 stars 160 forks source link

make_expression with ec broken in v0.172.0 #470

Closed meierfra-ergon closed 9 months ago

meierfra-ergon commented 9 months ago

after update to 0.172.0 my code using following make_expression() function

template <class Json>
jsonpath_expression<Json> make_expression(const Json::string_view_type& expr,
    std::error_code& ec);

(https://github.com/danielaparker/jsoncons/blob/v0.172.0/doc/ref/jsonpath/make_expression.md) does not compile anymore. it seems a wrapper function is missing in jsonpath_expression.hpp something like:

template <class Json>
auto make_expression(const typename Json::string_view_type& expr, std::error_code& ec) {
  return make_expression<Json>(combine_allocators(), expr, custom_functions<Json>(), ec);
}

What is the expected behavior? code should compile with make_expression(expr, ec)

What is the actual behavior? compile error -> "no matching function for call to 'make_expression'"

Enumerate the steps to reproduce the bug

Include a small, self-contained example if possible

What compiler, architecture, and operating system?

What jsoncons library version?

meierfra-ergon commented 9 months ago

BTW I think I found another bug, while writing the wrapper with make_expression(combine_allocators(), expr, ec) (using the 3 argument variant), it would not compile either.

Changing the inner call to make_expression() https://github.com/danielaparker/jsoncons/blob/c266fdfa9d21c24a92a946526d7fb14452487352/include/jsoncons_ext/jsonpath/jsonpath_expression.hpp#L197 to return make_expression<Json>(alloc_set, expr, custom_functions<Json>(), ec); fixes this

danielaparker commented 9 months ago

Yes, thanks for reporting this, fixed on master.

danielaparker commented 9 months ago

Fixed in 0.172.1