Skip to content

std::char_traits<std::byte> removed in libc++ 18 #366

Closed
@Altren

Description

@Altren

Reflect-cpp can't be compiled with XCode 16.3 because of this.
https://github.com/llvm/llvm-project/blob/release/17.x/libcxx/docs/ReleaseNotes/17.rst#llvm-18
So it seems that something like std::vectorstd::byte should be used.
I tried to do this myself, and few build issues in the library are trivial, but I don't understand what's wrong here:

In file included from /Users/gevmenov/libs/reflect-cpp/include/rfl.hpp:55:
In file included from /Users/gevmenov/libs/reflect-cpp/include/rfl/enums.hpp:7:
/Users/gevmenov/libs/reflect-cpp/include/rfl/internal/enums/StringConverter.hpp:42:19: error: static assertion failed due to requirement 'names_.size != 0': No enum could be identified. Please choose enum values between 0 to 127 or for flag enums choose 1,2,4,8,16,...
   42 |     static_assert(names_.size != 0,
      |                   ^~~~~~~~~~~~~~~~
/Users/gevmenov/libs/reflect-cpp/include/rfl/generic/../parsing/Parser_default.hpp:83:32: note: in instantiation of member function 'rfl::internal::enums::StringConverter<std::byte>::string_to_enum' requested here
   83 |               StringConverter::string_to_enum);
      |                                ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/generic/../parsing/VectorReader.hpp:28:70: note: in instantiation of member function 'rfl::parsing::Parser<rfl::msgpack::Reader, rfl::msgpack::Writer, std::byte, rfl::Processors<>>::read' requested here
   28 |         return Parser<R, W, std::remove_cvref_t<T>, ProcessorsType>::read(*r_,
      |                                                                      ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/msgpack/Reader.hpp:87:38: note: in instantiation of member function 'rfl::parsing::VectorReader<rfl::msgpack::Reader, rfl::msgpack::Writer, std::vector<std::byte>, rfl::Processors<>>::read' requested here
   87 |       const auto err = _array_reader.read(_arr.ptr[i]);
      |                                      ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/generic/../parsing/VectorParser.hpp:58:29: note: in instantiation of function template specialization 'rfl::msgpack::Reader::read_array<rfl::parsing::VectorReader<rfl::msgpack::Reader, rfl::msgpack::Writer, std::vector<std::byte>, rfl::Processors<>>>' requested here
   58 |         const auto err = _r.read_array(vector_reader, _arr);
      |                             ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/generic/../parsing/ViewReader.hpp:53:51: note: in instantiation of member function 'rfl::parsing::VectorParser<rfl::msgpack::Reader, rfl::msgpack::Writer, std::vector<std::byte>, rfl::Processors<>>::read' requested here
   53 |       auto res = Parser<R, W, T, ProcessorsType>::read(_r, _var);
      |                                                   ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/generic/../parsing/ViewReader.hpp:102:6: note: in instantiation of function template specialization 'rfl::parsing::ViewReader<rfl::msgpack::Reader, rfl::msgpack::Writer, rfl::NamedTuple<rfl::Field<internal::StringLiteral<11>{{"bytestring"}}, std::vector<std::byte> *>>, rfl::Processors<>>::assign_if_field_matches<0, msgpack_object, rfl::NamedTuple<rfl::Field<internal::StringLiteral<11>{{"bytestring"}}, std::vector<std::byte> *>>, std::vector<rfl::Error>, std::array<bool, 1>, std::array<bool, 1>>' requested here
  102 |     (assign_if_field_matches<is>(_r, _current_name, _var, _view, _errors,
      |      ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/generic/../parsing/ViewReader.hpp:33:5: note: in instantiation of function template specialization 'rfl::parsing::ViewReader<rfl::msgpack::Reader, rfl::msgpack::Writer, rfl::NamedTuple<rfl::Field<internal::StringLiteral<11>{{"bytestring"}}, std::vector<std::byte> *>>, rfl::Processors<>>::assign_to_matching_field<0, msgpack_object, rfl::NamedTuple<rfl::Field<internal::StringLiteral<11>{{"bytestring"}}, std::vector<std::byte> *>>, std::vector<rfl::Error>, std::array<bool, 1>, std::array<bool, 1>>' requested here
   33 |     assign_to_matching_field(*r_, _name, _var, view_, errors_, found_, set_,
      |     ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/msgpack/Reader.hpp:106:22: note: in instantiation of member function 'rfl::parsing::ViewReader<rfl::msgpack::Reader, rfl::msgpack::Writer, rfl::NamedTuple<rfl::Field<internal::StringLiteral<11>{{"bytestring"}}, std::vector<std::byte> *>>, rfl::Processors<>>::read' requested here
  106 |       _object_reader.read(name, val);
      |                      ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/generic/../parsing/NamedTupleParser.hpp:308:16: note: in instantiation of function template specialization 'rfl::msgpack::Reader::read_object<rfl::parsing::ViewReader<rfl::msgpack::Reader, rfl::msgpack::Writer, rfl::NamedTuple<rfl::Field<internal::StringLiteral<11>{{"bytestring"}}, std::vector<std::byte> *>>, rfl::Processors<>>>' requested here
  308 |       err = _r.read_object(reader, _obj_or_arr);
      |                ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/generic/../parsing/NamedTupleParser.hpp:121:14: note: in instantiation of member function 'rfl::parsing::NamedTupleParser<rfl::msgpack::Reader, rfl::msgpack::Writer, false, true, false, rfl::Processors<>, rfl::Field<internal::StringLiteral<11>{{"bytestring"}}, std::vector<std::byte> *>>::read_object_or_array' requested here
  121 |       return read_object_or_array(_r, *obj, _view);
      |              ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/generic/../parsing/Parser_default.hpp:262:49: note: in instantiation of member function 'rfl::parsing::NamedTupleParser<rfl::msgpack::Reader, rfl::msgpack::Writer, false, true, false, rfl::Processors<>, rfl::Field<internal::StringLiteral<11>{{"bytestring"}}, std::vector<std::byte> *>>::read_view' requested here
  262 |         Parser<R, W, ViewType, ProcessorsType>::read_view(_r, _var, &view);
      |                                                 ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/generic/../parsing/Parser_default.hpp:74:18: note: in instantiation of member function 'rfl::parsing::Parser<rfl::msgpack::Reader, rfl::msgpack::Writer, test_bytestring::TestStruct, rfl::Processors<>>::read_struct' requested here
   74 |           return read_struct(_r, _var);
      |                  ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/msgpack/read.hpp:24:40: note: in instantiation of member function 'rfl::parsing::Parser<rfl::msgpack::Reader, rfl::msgpack::Writer, test_bytestring::TestStruct, rfl::Processors<>>::read' requested here
   24 |   return Parser<T, Processors<Ps...>>::read(r, _obj);
      |                                        ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/msgpack/read.hpp:43:10: note: in instantiation of function template specialization 'rfl::msgpack::read<test_bytestring::TestStruct>' requested here
   43 |   return read<T, Ps...>(_bytes.data(), _bytes.size());
      |          ^
/Users/gevmenov/libs/reflect-cpp/tests/msgpack/test_bytestring.cpp:19:3: note: in instantiation of function template specialization 'write_and_read<test_bytestring::TestStruct>' requested here
   19 |   write_and_read(test);
      |   ^
/Users/gevmenov/libs/reflect-cpp/include/rfl/internal/enums/StringConverter.hpp:42:31: note: expression evaluates to '0 != 0'
   42 |     static_assert(names_.size != 0,
      |                   ~~~~~~~~~~~~^~~~```

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions