microsoft / yardl

Tooling for streaming instrument data
https://microsoft.github.io/yardl/
MIT License
29 stars 5 forks source link

Union of aliased type compiler error for C++ NDJSON #125

Closed naegelejd closed 1 month ago

naegelejd commented 5 months ago

Using 28aa4af and the following model:

UnionOfAlias: !protocol
  sequence:
    variant: [int, string]
    variantAlias: [AliasedInt, string]

produces the following compiler error for the C++ NDJSON serialization:

/workspaces/yardl/joe/quickcheck/cpp/generated/ndjson/protocols.cc:33:8: error: redefinition of 'struct nlohmann::json_abi_v3_11_2::adl_serializer<std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >'
   33 | struct adl_serializer<std::variant<check::AliasedInt, std::string>> {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspaces/yardl/joe/quickcheck/cpp/generated/ndjson/protocols.cc:14:8: note: previous definition of 'struct nlohmann::json_abi_v3_11_2::adl_serializer<std::variant<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >'
   14 | struct adl_serializer<std::variant<int32_t, std::string>> {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~