Giter VIP home page Giter VIP logo

Comments (8)

stephenberry avatar stephenberry commented on May 24, 2024

Strange, I tested with Clang 18, but I'll have to set up an environment to test with Clang 19. The behavior seems strange.

Can you try using the latest release (v2.5.2)? Because the main branch has some #include refactoring associated with dump.hpp.

from glaze.

maldag avatar maldag commented on May 24, 2024

I was using the main branch at commit cdd097a

Using the tag 2.5.2 with hash 4749325 also yields errors:

In file included from /project/test/unittest/glazeJson/test_json.cpp:7:
In file included from /project/build_gtest/_deps/glaze-src/include/glaze/glaze.hpp:36:
In file included from /project/build_gtest/_deps/glaze-src/include/glaze/binary/beve_to_json.hpp:7:
/project/build_gtest/_deps/glaze-src/include/glaze/json/write.hpp:1116:16: error: no matching function for call to 'dump'
 1116 |                dump<'{'>(b, ix);
      |                ^~~~~~~~~
/project/build_gtest/_deps/glaze-src/include/glaze/json/write.hpp:1107:16: note: in instantiation of function template specialization 'glz::detail::to_json<my_struct>::op_base<opts{10, false, true, true, true, true, 32, 3, true, false, true, false, false, false, 0, false, false, false, false, false, false, true, true, false, false, false, false, true}, my_struct &, glz::context &, const std::basic_string<char> &, unsigned long &>' requested here
 1107 |                op_base<write_unknown_on<Options>()>(std::forward<V>(value), ctx, b, ix);
      |                ^
/project/build_gtest/_deps/glaze-src/include/glaze/json/write.hpp:30:55: note: in instantiation of function template specialization 'glz::detail::to_json<my_struct>::op<opts{10, false, true, true, true, true, 32, 3, true, false, true, false, false, false, 0, false, false, false, false, false, false, true, true, false, false, false, false, true}, my_struct &, glz::context &, const std::basic_string<char> &, unsigned long &>' requested here
   30 |             to_json<std::remove_cvref_t<T>>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx),
      |                                                       ^
/project/build_gtest/_deps/glaze-src/include/glaze/core/write.hpp:42:44: note: in instantiation of function template specialization 'glz::detail::write<10>::op<opts{10, false, true, true, true, true, 32, 3, true, false, true, false, false, false, 0, false, false, false, false, false, false, true, true, false, false, false, false, true}, my_struct &, glz::context &, const std::basic_string<char> &, unsigned long &>' requested here
   42 |       detail::write<Opts.format>::template op<Opts>(std::forward<T>(value), ctx, buffer, ix);
      |                                            ^
/project/build_gtest/_deps/glaze-src/include/glaze/core/write.hpp:72:7: note: in instantiation of function template specialization 'glz::write<opts{10, false, true, true, true, true, 32, 3, true, false, true, false, false, false, 0, false, false, false, false, false, false, true, true, false, false, false, false, true}, my_struct &, const std::basic_string<char>, glz::context &>' requested here
   72 |       rite<Opts>(std::forward<T>(value), buffer, ctx);
      |       ^
/project/test/unittest/glazeJson/test_json.cpp:28:10: note: in instantiation of function template specialization 'glz::write<opts{10, false, true, true, true, true, 32, 3, true, false, true, false, false, false, 0, false, false, false, false, false, false, true, true, false, false, false, false, true}, my_struct &, const std::basic_string<char>>' requested here
   28 |     glz::write<glz::opts{.prettify = true}>(s, buffer);
      |          ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:31:27: note: candidate template ignored: constraints not satisfied [with c = '{', b:auto = const std::basic_string<char>, ix:auto = unsigned long]
   31 |    GLZ_ALWAYS_INLINE void dump(vector_like auto& b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:31:32: note: because 'const std::basic_string<char>' does not satisfy 'vector_like'
   31 |    GLZ_ALWAYS_INLINE void dump(vector_like auto& b, auto& ix) noexcept
      |                                ^
/project/build_gtest/_deps/glaze-src/include/glaze/core/common.hpp:339:29: note: because 'const std::basic_string<char>' does not satisfy 'resizeable'
  339 |       concept vector_like = resizeable<T> && accessible<T> && has_data<T>;
      |                             ^
/project/build_gtest/_deps/glaze-src/include/glaze/concepts/container_concepts.hpp:69:59: note: because 'container.resize(0)' would be invalid: no matching member function for call to 'resize'
   69 |    concept resizable = requires(T container) { container.resize(0); };
      |                                                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:48:27: note: candidate template ignored: could not match 'auto *' against 'std::basic_string<char>'
   48 |    GLZ_ALWAYS_INLINE void dump(auto* b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:110:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'str'
  110 |    GLZ_ALWAYS_INLINE void dump(vector_like auto& b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:124:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'str'
  124 |    GLZ_ALWAYS_INLINE void dump(auto* b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:151:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'str'
  151 |    GLZ_ALWAYS_INLINE void dump(vector_like auto& b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:165:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'str'
  165 |    GLZ_ALWAYS_INLINE void dump(auto* b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:215:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'c'
  215 |    GLZ_ALWAYS_INLINE void dump(B&& b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:233:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'B'
  233 |    GLZ_ALWAYS_INLINE void dump(std::byte c, B&& b) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:264:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'B'
  264 |    GLZ_ALWAYS_INLINE void dump(const std::span<const std::byte> bytes, B&& b) noexcept
      |  

In file included from /project/test/unittest/glazeJson/test_json.cpp:7:
In file included from /project/build_gtest/_deps/glaze-src/include/glaze/glaze.hpp:36:
In file included from /project/build_gtest/_deps/glaze-src/include/glaze/binary/beve_to_json.hpp:7:
/project/build_gtest/_deps/glaze-src/include/glaze/json/write.hpp:1215:22: error: no matching function for call to 'dump'
 1215 |                      dump<':'>(b, ix);
      |                      ^~~~~~~~~
/project/build_gtest/_deps/glaze-src/include/glaze/json/write.hpp:1157:37: note: while substituting into a lambda expression here
 1157 |             for_each<N>([&](auto I) {
      |                                     ^
/project/build_gtest/_deps/glaze-src/include/glaze/json/write.hpp:1107:16: note: in instantiation of function template specialization 'glz::detail::to_json<my_struct>::op_base<opts{10, false, true, true, true, true, 32, 3, true, false, true, false, false, false, 0, false, false, false, false, false, false, true, true, false, false, false, false, true}, my_struct &, glz::context &, const std::basic_string<char> &, unsigned long &>' requested here
 1107 |                op_base<write_unknown_on<Options>()>(std::forward<V>(value), ctx, b, ix);
      |                ^
/project/build_gtest/_deps/glaze-src/include/glaze/json/write.hpp:30:55: note: in instantiation of function template specialization 'glz::detail::to_json<my_struct>::op<opts{10, false, true, true, true, true, 32, 3, true, false, true, false, false, false, 0, false, false, false, false, false, false, true, true, false, false, false, false, true}, my_struct &, glz::context &, const std::basic_string<char> &, unsigned long &>' requested here
   30 |             to_json<std::remove_cvref_t<T>>::template op<Opts>(std::forward<T>(value), std::forward<Ctx>(ctx),
      |                                                       ^
/project/build_gtest/_deps/glaze-src/include/glaze/core/write.hpp:42:44: note: in instantiation of function template specialization 'glz::detail::write<10>::op<opts{10, false, true, true, true, true, 32, 3, true, false, true, false, false, false, 0, false, false, false, false, false, false, true, true, false, false, false, false, true}, my_struct &, glz::context &, const std::basic_string<char> &, unsigned long &>' requested here
   42 |       detail::write<Opts.format>::template op<Opts>(std::forward<T>(value), ctx, buffer, ix);
      |                                            ^
/project/build_gtest/_deps/glaze-src/include/glaze/core/write.hpp:72:7: note: in instantiation of function template specialization 'glz::write<opts{10, false, true, true, true, true, 32, 3, true, false, true, false, false, false, 0, false, false, false, false, false, false, true, true, false, false, false, false, true}, my_struct &, const std::basic_string<char>, glz::context &>' requested here
72 |       write<Opts>(std::forward<T>(value), buffer, ctx);
      |       ^
/project/test/unittest/glazeJson/test_json.cpp:28:10: note: in instantiation of function template specialization 'glz::write<opts{10, false, true, true, true, true, 32, 3, true, false, true, false, false, false, 0, false, false, false, false, false, false, true, true, false, false, false, false, true}, my_struct &, const std::basic_string<char>>' requested here
   28 |     glz::write<glz::opts{.prettify = true}>(s, buffer);
      |          ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:31:27: note: candidate template ignored: constraints not satisfied [with c = ':', b:auto = const std::basic_string<char>, ix:auto = unsigned long]
   31 |    GLZ_ALWAYS_INLINE void dump(vector_like auto& b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:31:32: note: because 'const std::basic_string<char>' does not satisfy 'vector_like'
   31 |    GLZ_ALWAYS_INLINE void dump(vector_like auto& b, auto& ix) noexcept
      |                                ^
/project/build_gtest/_deps/glaze-src/include/glaze/core/common.hpp:339:29: note: because 'const std::basic_string<char>' does not satisfy 'resizeable'
  339 |       concept vector_like = resizeable<T> && accessible<T> && has_data<T>;
      |                             ^
/project/build_gtest/_deps/glaze-src/include/glaze/concepts/container_concepts.hpp:69:59: note: because 'container.resize(0)' would be invalid: no matching member function for call to 'resize'
   69 |    concept resizeable = requires(T container) { container.resize(0); };
      |                                                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:48:27: note: candidate template ignored: could not match 'auto *' against 'std::basic_string<char>'
   48 |    GLZ_ALWAYS_INLINE void dump(auto* b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:110:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'str'
  110 |    GLZ_ALWAYS_INLINE void dump(vector_like auto& b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:124:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'str'
  124 |    GLZ_ALWAYS_INLINE void dump(auto* b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:151:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'str'
  151 |    GLZ_ALWAYS_INLINE void dump(vector_like auto& b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:165:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'str'
  165 |    GLZ_ALWAYS_INLINE void dump(auto* b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:215:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'c'
  215 |    GLZ_ALWAYS_INLINE void dump(B&& b, auto& ix) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:233:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'B'
  233 |    GLZ_ALWAYS_INLINE void dump(std::byte c, B&& b) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:264:27: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'B'
  264 |    GLZ_ALWAYS_INLINE void dump(const std::span<const std::byte> bytes, B&& b) noexcept
      |                           ^
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:94:27: note: candidate function template not viable: requires single argument 'b', but 2 arguments were provided
   94 |    GLZ_ALWAYS_INLINE void dump(char*&b) noexcept
      |                           ^    ~~~~~~~~
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:101:27: note: candidate function template not viable: requires single argument 'b', but 2 arguments were provided
  101 |    GLZ_ALWAYS_INLINE void dump(char*& ) noexcept
      |                           ^    ~~~~~~~~
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:202:27: note: candidate function template not viable: requires single argument 'b', but 2 arguments were provided
  202 |    GLZ_ALWAYS_INLINE void dump(B&& b) noexcept
      | 
                         ^    ~~~~~/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:14:27: note: candidate function template not viable: requires 3 arguments, but 2 were provided
   14 |    GLZ_ALWAYS_INLINE void dump(const char c, vector_like auto& b, auto& ix) noexcept
      |                           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:285:27: note: candidate function template not viable: requires 3 arguments, but 2 were provided
  285 |    GLZ_ALWAYS_INLINE void dump(const std::array<uint8_t, N>& bytes, B&& b, auto& ix) noexcept
      |                           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:174:27: note: candidate function template not viable: requires 3 arguments, but 2 were provided
  174 |    GLZ_ALWAYS_INLINE void dump(const sv str, vector_like auto& b, auto& ix) noexcept
      |                           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:185:27: note: candidate function template not viable: requires 3 arguments, but 2 were provided
  185 |    GLZ_ALWAYS_INLINE void dump(const sv str, auto* b, auto& ix) noexcept
      |                           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:273:27: note: candidate function template not viable: requires 3 arguments, but 2 were provided
  273 |    GLZ_ALWAYSINLINE void dump(const std::span<const std::byte> bytes, B&& b, auto& ix) noexcept
      |                           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/project/build_gtest/_deps/glaze-src/include/glaze/util/dump.hpp:246:27: note: candidate function template not viable: requires 3 arguments, but 2 were provided
  246 |    GLZ_ALWAYS_INLINE void dump(std::byte c, auto&& b, auto& ix) noexcept
      |                           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error.log

from glaze.

stephenberry avatar stephenberry commented on May 24, 2024

I would be surprised if Clang 19 introduced significant compiler bugs. It's probably something wrong with your setup. I'll build a dev container with Clang 19 to test. But, the code builds with Clang 15,16,17, and 18

from glaze.

stephenberry avatar stephenberry commented on May 24, 2024

Clang 19 works on compiler explorer: https://gcc.godbolt.org/z/WzzshzffM

from glaze.

maldag avatar maldag commented on May 24, 2024

Well, testing with clang 19 it does not compile using write-Method with prettier: https://gcc.godbolt.org/z/9d4M1Yh1f

from glaze.

stephenberry avatar stephenberry commented on May 24, 2024

Oh, thank you! Will fix ASAP.

from glaze.

stephenberry avatar stephenberry commented on May 24, 2024

The issue is actually not a bug, but that you're trying to write to a const std::string buffer. If you remove const, the code will build and run as intended.

This does indicate that we need much better error messages when someone tries to write to a const qualified buffer. I'll keep this issue open until that is resolved.

from glaze.

stephenberry avatar stephenberry commented on May 24, 2024

Better erroring when trying to write to a const buffer has been added.

Thanks for bringing this up!

from glaze.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.