Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error with clang: exception specification of explicitly defaulted copy constructor does not match the calculated one #328

Closed
1 of 3 tasks
ethanhschwartz opened this issue Aug 11, 2021 · 3 comments

Comments

@ethanhschwartz
Copy link

Trying to compile with clang version 8.0.1 I get an error because clang does not agree with the exception specification of the copy constructor on the parameter template class in expression.hpp. It looks like this dates back to 9e61d9f
(apologies I haven't tried newer clang or other compiler flags)

% /opt/rh/llvm-toolset-8.0/root/usr/bin/clang++ \
 -I.../_deps/jsoncons-src/include \
 -I.../_deps/jsoncons-src/tests \
 -I.../_deps/jsoncons-src/third_party \
 -I.../_deps/jsoncons-src/third_party/catch  \
 -o CMakeFiles/unit_tests.dir/jsonpath/src/jsonpath_flatten_tests.cpp.o \
 -c .../_deps/jsoncons-src/tests/jsonpath/src/jsonpath_flatten_tests.cpp


.../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/expression.hpp:262:9: error: exception specification of explicitly defaulted
      copy constructor does not match the calculated one
        parameter(const parameter& other) noexcept = default;
        ^
/opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/stl_vector.h:806:50: note: in instantiation of template class
      'jsoncons::jsonpath::parameter<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> > >' requested here
      { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
                                                 ^
.../_deps/jsoncons-src/include/jsoncons/detail/span.hpp:90:40: note: in instantiation of member function
      'std::vector<jsoncons::jsonpath::parameter<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> > >,
      std::allocator<jsoncons::jsonpath::parameter<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> > > > >::size' requested here
            : data_(c.data()), size_(c.size())
                                       ^
.../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/expression.hpp:1042:9: note: in instantiation of member function
      'jsoncons::jsonpath::detail::decorator_function<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> > >::evaluate' requested here
        decorator_function(jsoncons::optional<std::size_t> arity,
        ^
.../_deps/jsoncons-src/include/jsoncons/config/jsoncons_config.hpp:103:39: note: in instantiation of member function
      'jsoncons::jsonpath::detail::decorator_function<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> > >::decorator_function' requested here
        return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
                                      ^
.../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/expression.hpp:2340:53: note: in instantiation of function template
      specialization 'jsoncons::make_unique<jsoncons::jsonpath::detail::decorator_function<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> > >,
      jsoncons::detail::optional<unsigned long>, const std::function<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >
      (jsoncons::detail::span<const jsoncons::jsonpath::parameter<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> > >, 18446744073709551615>,
      std::error_code &)> &>' requested here
                                          jsoncons::make_unique<decorator_function<Json>>(item.arity(),item.function()));
                                                    ^
.../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/jsonpath_expression.hpp:2572:80: note: in instantiation of member function
      'jsoncons::jsonpath::detail::static_resources<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >, const jsoncons::basic_json<char,
      jsoncons::sorted_policy, std::allocator<char> > &>::static_resources' requested here
            jsoncons::jsonpath::detail::static_resources<value_type,reference> resources(functions);
                                                                               ^
.../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/jsonpath_expression.hpp:2594:43: note: in instantiation of member function
      'jsoncons::jsonpath::jsonpath_expression<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> >, const jsoncons::basic_json<char,
      jsoncons::sorted_policy, std::allocator<char> > &>::compile' requested here
        return jsonpath_expression<Json>::compile(expr, functions);
                                          ^
.../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/json_query.hpp:22:21: note: in instantiation of function template
      specialization 'jsoncons::jsonpath::make_expression<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> > >' requested here
        auto expr = make_expression<Json>(path, functions);
                    ^
.../_deps/jsoncons-src/tests/jsonpath/src/jsonpath_flatten_tests.cpp:114:40: note: in instantiation of function template
      specialization 'jsoncons::jsonpath::json_query<jsoncons::basic_json<char, jsoncons::sorted_policy, std::allocator<char> > >' requested here
        auto result = jsoncons::jsonpath::json_query(doc, path);
                                          ^
In file included from .../_deps/jsoncons-src/tests/jsonpath/src/jsonpath_flatten_tests.cpp:8:
In file included from .../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/flatten.hpp:18:
In file included from .../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/jsonpath.hpp:10:
In file included from .../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/json_query.hpp:11:
In file included from .../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/jsonpath_expression.hpp:20:
.../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/expression.hpp:266:20: error: exception specification of explicitly defaulted
      copy assignment operator does not match the calculated one
        parameter& operator=(const parameter& other) noexcept = default;
                   ^
.../_deps/jsoncons-src/include/jsoncons_ext/jsonpath/expression.hpp:268:20: error: exception specification of explicitly defaulted
      move assignment operator does not match the calculated one
        parameter& operator=(parameter&& other) noexcept = default;
                   ^
3 errors generated.

What compiler, architecture, and operating system?

  • Compiler: clang++ 8.0.1
  • Architecture (e.g. x86, x64) x86_64
  • Operating system: CentOS Linux release 7.9.2009

What jsoncons library version?

  • Latest release 0.167.0
  • Other release ______
  • master
@danielaparker
Copy link
Owner

Thanks for reporting this. I believe clang 8 doesn't like noexcept in combination with = default. With travis CI no longer a practical option for open source, we've lost some of our test coverage for older versions of clang, and this crept in. We'll address it shortly.

@danielaparker
Copy link
Owner

Could you check if it compiles with clang 8.1 on master? Thanks.

@ethanhschwartz
Copy link
Author

I am able to compile on Clang 8.0.1 now. Thanks for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants