Dear reflect-cpp team,
I currently encounter some errors using clang-tidy while building using MSVC (cl.exe). Without clang-tidy or with other compilers this is not a problem at all. Below you can find the attached (anonymized) error log:
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json\../parsing\..\internal/enums\../..\internal/no_duplicate_field_names.hpp:22:19: error: static assertion failed due to requirement 'no_duplicate': Duplicate field names are not allowed in either named tuples or Literals. [clang-diagnostic-error]
22 | static_assert(no_duplicate,
| ^~~~~~~~~~~~
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json\../parsing\..\internal/enums\../..\internal/no_duplicate_field_names.hpp:30:4: note: in instantiation of function template specialization 'rfl::internal::no_duplicate_field_names_helpers::compare_two_fields<rfl::Tuple<rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>>, 4, 3>' requested here
30 | (compare_two_fields<Fields, _i, _js>(), ...);
| ^
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json\../parsing\..\internal/enums\../..\internal/no_duplicate_field_names.hpp:35:4: note: in instantiation of function template specialization 'rfl::internal::no_duplicate_field_names_helpers::iterate_over_j<rfl::Tuple<rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>>, 4, 0, 1, 2, 3>' requested here
35 | (iterate_over_j<Fields, _is>(std::make_integer_sequence<int, _is>()), ...);
| ^
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json\../parsing\..\internal/enums\../..\internal/no_duplicate_field_names.hpp:46:39: note: in instantiation of function template specialization 'rfl::internal::no_duplicate_field_names_helpers::iterate_over_i<rfl::Tuple<rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>>, 0, 1, 2, 3, 4>' requested here
46 | no_duplicate_field_names_helpers::iterate_over_i<Fields>(
| ^
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json\../parsing\..\internal/enums\../../Literal.hpp:118:23: note: in instantiation of function template specialization 'rfl::internal::no_duplicate_field_names<rfl::Tuple<rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>, rfl::LiteralHelper<internal::StringLiteral<22>{{"get_field_name_str_vi"}}>>>' requested here
118 | return !internal::no_duplicate_field_names<FieldsType>();
| ^
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json\../parsing\..\internal/enums\../../Literal.hpp:339:45: note: in instantiation of member function 'rfl::Literal<internal::StringLiteral<22>{{"get_field_name_str_vi"}}, internal::StringLiteral<22>{{"get_field_name_str_vi"}}, internal::StringLiteral<22>{{"get_field_name_str_vi"}}, internal::StringLiteral<22>{{"get_field_name_str_vi"}}, internal::StringLiteral<22>{{"get_field_name_str_vi"}}>::has_duplicates' requested here
339 | static_assert(sizeof...(fields_) <= 1 || !has_duplicates(),
| ^
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json\../parsing\..\internal\..\internal\..\internal/get_field_names.hpp:126:15: note: (skipping 8 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
126 | return rfl::Literal<_head, _tail...>::template from_value<0>();
| ^
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json\../parsing\../internal/has_default_val_v.hpp:31:41: note: in instantiation of template type alias 'named_tuple_t' requested here
31 | struct HasDefaultVal<T> : HasDefaultVal<named_tuple_t<T>> {};
| ^
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json\../parsing\../internal/has_default_val_v.hpp:41:36: note: in instantiation of template class 'rfl::internal::HasDefaultVal<MyStruct>' requested here
41 | constexpr bool has_default_val_v = HasDefaultVal<std::remove_cvref_t<T>>::value;
| ^
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json\../parsing\Parser_default.hpp:83:38: note: in instantiation of variable template specialization 'rfl::internal::has_default_val_v<MyStruct>' requested here
83 | internal::has_default_val_v<T>) {
| ^
D:\workspace\proj\build-clang-tidy\_deps\reflect-cpp-src\include\rfl/json/read.hpp:48:44: note: in instantiation of member function 'rfl::parsing::Parser<rfl::json::Reader, rfl::json::Writer, MyStruct, rfl::Processors<rfl::DefaultIfMissing>>::read' requested here
48 | auto res = Parser<T, Processors<Ps...>>::read(r, InputVarType(root));
| ^
D:\workspace\proj\src\my-lib\src\attrib.hpp:57:17: note: in instantiation of function template specialization 'rfl::json::read<MyStruct, rfl::DefaultIfMissing>' requested here
57 | rfl::json::read<MyStruct, rfl::DefaultIfMissing>(
The struct in question looks like this:
struct MyStruct
{
std::string message{};
std::string ticket_id{};
bool exclude{};
std::vector<std::vector<std::string>> template_insts{};
bool export_alias{};
auto operator<=>(MyStruct const& other) const = default;
};
The error occurs using the following tooling:
- Ninja (1.13.2)
- MSVC (19.29.30159.0)
- CMake (4.2.1)
- Clang-Tidy (19.1.7)
- reflect-cpp (0.24.0)
While this "error" is rather cosmetic as it only occurs using clang-tidy, it would be nice if you can take a look. Let me know if I can assist any further!
Best, Sebastian
Dear reflect-cpp team,
I currently encounter some errors using clang-tidy while building using MSVC (cl.exe). Without clang-tidy or with other compilers this is not a problem at all. Below you can find the attached (anonymized) error log:
The struct in question looks like this:
The error occurs using the following tooling:
While this "error" is rather cosmetic as it only occurs using clang-tidy, it would be nice if you can take a look. Let me know if I can assist any further!
Best, Sebastian