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

use of overloaded operator '<=>' is ambiguous #4197

Open
2 tasks done
nlohmann opened this issue Oct 31, 2023 · 10 comments
Open
2 tasks done

use of overloaded operator '<=>' is ambiguous #4197

nlohmann opened this issue Oct 31, 2023 · 10 comments
Labels
kind: bug state: help needed the issue needs help to proceed

Comments

@nlohmann
Copy link
Owner

Description

I want to prepare the next release, but compiling the example file docs/examples/operator_spaceship__const_reference.c++20.cpp fails.

Reproduction steps

Compile file docs/examples/operator_spaceship__const_reference.c++20.cpp.

  • Delete docs/examples/operator_spaceship__const_reference.c++20.output
  • Call make -Cdocs create_output

Expected vs. actual results

Expected: No error.

Actual: Compilation error.

Minimal code example

#include <compare>
#include <iostream>
#include <nlohmann/json.hpp>

using json = nlohmann::json;

const char* to_string(const std::partial_ordering& po)
{
    if (std::is_lt(po))
    {
        return "less";
    }
    else if (std::is_gt(po))
    {
        return "greater";
    }
    else if (std::is_eq(po))
    {
        return "equivalent";
    }
    return "unordered";
}

int main()
{
    // create several JSON values
    json array_1 = {1, 2, 3};
    json array_2 = {1, 2, 4};
    json object_1 = {{"A", "a"}, {"B", "b"}};
    json object_2 = {{"B", "b"}, {"A", "a"}};
    json number = 17;
    json string = "foo";
    json discarded = json(json::value_t::discarded);

    // output values and comparisons
    std::cout << array_1 << " <=> " << array_2 << " := " << to_string(array_1 <=> array_2) << '\n'; // *NOPAD*
    std::cout << object_1 << " <=> " << object_2 << " := " << to_string(object_1 <=> object_2) << '\n'; // *NOPAD*
    std::cout << string << " <=> " << number << " := " << to_string(string <=> number) << '\n'; // *NOPAD*
    std::cout << string << " <=> " << discarded << " := " << to_string(string <=> discarded) << '\n'; // *NOPAD*
}

Error messages

make create_output
standard
/Library/Developer/CommandLineTools/usr/bin/make examples/operator_spaceship__const_reference.c++20 \
		CPPFLAGS="-I ../single_include -DJSON_USE_GLOBAL_UDLS=0" \
		CXXFLAGS="-std=c++20 -Wno-deprecated-declarations"
c++ -std=c++20 -Wno-deprecated-declarations -I ../single_include -DJSON_USE_GLOBAL_UDLS=0   examples/operator_spaceship__const_reference.c++20.cpp   -o examples/operator_spaceship__const_reference.c++20
examples/operator_spaceship__const_reference.c++20.cpp:36:79: error: use of overloaded operator '<=>' is ambiguous (with operand types 'json' (aka 'basic_json<>') and 'json')
    std::cout << array_1 << " <=> " << array_2 << " := " << to_string(array_1 <=> array_2) << '\n'; // *NOPAD*
                                                                      ~~~~~~~ ^   ~~~~~~~
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(enum nlohmann::detail::value_t, enum nlohmann::detail::value_t)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(float, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(double, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long double, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(int, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(long long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(__int128, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned int, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned long long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, float)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, long double)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: built-in candidate operator<=>(unsigned __int128, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: error: use of overloaded operator '<=>' is ambiguous (with operand types 'json' (aka 'basic_json<>') and 'json')
    std::cout << object_1 << " <=> " << object_2 << " := " << to_string(object_1 <=> object_2) << '\n'; // *NOPAD*
                                                                        ~~~~~~~~ ^   ~~~~~~~~
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(enum nlohmann::detail::value_t, enum nlohmann::detail::value_t)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(float, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(double, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long double, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(int, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(long long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(__int128, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned int, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned long long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, float)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, long double)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:37:82: note: built-in candidate operator<=>(unsigned __int128, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: error: use of overloaded operator '<=>' is ambiguous (with operand types 'json' (aka 'basic_json<>') and 'json')
    std::cout << string << " <=> " << number << " := " << to_string(string <=> number) << '\n'; // *NOPAD*
                                                                    ~~~~~~ ^   ~~~~~~
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(enum nlohmann::detail::value_t, enum nlohmann::detail::value_t)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(float, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(double, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long double, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(int, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(long long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(__int128, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned int, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned long long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, float)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, long double)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:38:76: note: built-in candidate operator<=>(unsigned __int128, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: error: use of overloaded operator '<=>' is ambiguous (with operand types 'json' (aka 'basic_json<>') and 'json')
    std::cout << string << " <=> " << discarded << " := " << to_string(string <=> discarded) << '\n'; // *NOPAD*
                                                                       ~~~~~~ ^   ~~~~~~~~~
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(enum nlohmann::detail::value_t, enum nlohmann::detail::value_t)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(float, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(double, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long double, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(int, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(long long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(__int128, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned int, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned long long, unsigned __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, float)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, long double)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, __int128)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, unsigned int)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, unsigned long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, unsigned long long)
examples/operator_spaceship__const_reference.c++20.cpp:39:79: note: built-in candidate operator<=>(unsigned __int128, unsigned __int128)
4 errors generated.
make[1]: *** [examples/operator_spaceship__const_reference.c++20] Error 1
make: *** [examples/operator_spaceship__const_reference.c++20.output] Error 2

Compiler and operating system

Apple clang version 15.0.0 (clang-1500.0.40.1)

Library version

develop

Validation

@nlohmann nlohmann added kind: bug state: help needed the issue needs help to proceed labels Oct 31, 2023
@nlohmann nlohmann pinned this issue Oct 31, 2023
@nlohmann nlohmann mentioned this issue Oct 31, 2023
2 tasks
@ArsenArsen
Copy link
Contributor

this appear to be libcxx specific, as I couldn't reproduce it until I installed it and set CXX="clang++ -stdlib=libc++"

@ArsenArsen
Copy link
Contributor

defining JSON_HAS_THREE_WAY_COMPARISON to 1 fixes the issue. I see // # define __cpp_lib_three_way_comparison 201907L in the libcxx sources (at least the revision I have fetched locally). this trips the check in json.hpp.

@nlohmann
Copy link
Owner Author

nlohmann commented Nov 4, 2023

Thanks for the hint.

With -DJSON_HAS_THREE_WAY_COMPARISON=1 and Apple Clang, I get:

❯ make create_output
standard 
/Library/Developer/CommandLineTools/usr/bin/make examples/operator_spaceship__const_reference.c++20 \
                CPPFLAGS="-I ../single_include -DJSON_USE_GLOBAL_UDLS=0 -DJSON_HAS_THREE_WAY_COMPARISON=1" \
                CXXFLAGS="-std=c++20 -Wno-deprecated-declarations"
c++ -std=c++20 -Wno-deprecated-declarations -I ../single_include -DJSON_USE_GLOBAL_UDLS=0 -DJSON_HAS_THREE_WAY_COMPARISON=1   examples/operator_spaceship__const_reference.c++20.cpp   -o examples/operator_spaceship__const_reference.c++20
In file included from examples/operator_spaceship__const_reference.c++20.cpp:3:
../single_include/nlohmann/json.hpp:22948:33: error: invalid operands to binary expression ('array_t' (aka 'vector<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>, allocator<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>') and 'array_t')
        JSON_IMPLEMENT_OPERATOR(<=>, // *NOPAD*
        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../single_include/nlohmann/json.hpp:22815:52: note: expanded from macro 'JSON_IMPLEMENT_OPERATOR'
                return (*lhs.m_data.m_value.array) op (*rhs.m_data.m_value.array);                                     \
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
examples/operator_spaceship__const_reference.c++20.cpp:36:79: note: in instantiation of member function 'nlohmann::basic_json<>::operator<=>' requested here
    std::cout << array_1 << " <=> " << array_2 << " := " << to_string(array_1 <=> array_2) << '\n'; // *NOPAD*
                                                                              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__threading_support:682:17: note: candidate function not viable: no known conversion from 'array_t' (aka 'vector<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>, allocator<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>') to '__thread_id' for 1st argument
strong_ordering operator<=>(__thread_id __x, __thread_id __y) noexcept {
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__variant/monostate.h:32:49: note: candidate function not viable: no known conversion from 'array_t' (aka 'vector<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>, allocator<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>') to 'monostate' for 1st argument
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(monostate, monostate) noexcept {
                                                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/system_error:481:1: note: candidate function not viable: no known conversion from 'array_t' (aka 'vector<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>, allocator<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>') to 'const error_code' for 1st argument
operator<=>(const error_code& __x, const error_code& __y) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/system_error:489:1: note: candidate function not viable: no known conversion from 'array_t' (aka 'vector<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>, allocator<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>') to 'const error_condition' for 1st argument
operator<=>(const error_condition& __x, const error_condition& __y) noexcept
^
../single_include/nlohmann/json.hpp:2894:34: note: candidate function not viable: no known conversion from 'array_t' (aka 'vector<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>, allocator<basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>') to 'const value_t' for 1st argument
    inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD*
                                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__utility/pair.h:444:1: note: candidate template ignored: could not match 'pair' against 'vector'
operator<=>(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:288:1: note: candidate template ignored: could not match 'reverse_iterator' against 'vector'
operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:288:1: note: candidate template ignored: could not match 'reverse_iterator' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:566:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:566:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:658:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
operator<=>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:658:1: note: candidate template ignored: could not match 'unique_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1374:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1374:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1483:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1483:1: note: candidate template ignored: could not match 'shared_ptr' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:1572:1: note: candidate template ignored: could not match 'tuple' against 'vector'
operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:1572:1: note: candidate template ignored: could not match 'tuple' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:784:1: note: candidate template ignored: could not match 'basic_string_view' against 'vector'
operator<=>(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:797:38: note: candidate template ignored: could not match 'basic_string_view' against 'vector'
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:797:38: note: candidate template ignored: could not match 'basic_string_view' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/variant:1659:1: note: candidate template ignored: could not match 'variant' against 'vector'
operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/move_iterator.h:282:6: note: candidate template ignored: could not match 'move_iterator' against 'vector'
auto operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/move_iterator.h:282:6: note: candidate template ignored: could not match 'move_iterator' against 'vector'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4077:38: note: candidate template ignored: could not match 'basic_string' against 'vector'
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4085:1: note: candidate template ignored: could not match 'basic_string' against 'vector'
operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4085:1: note: candidate template ignored: could not match 'basic_string' against 'vector'
In file included from examples/operator_spaceship__const_reference.c++20.cpp:3:
../single_include/nlohmann/json.hpp:22948:33: error: invalid operands to binary expression ('object_t' (aka 'map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char>>, void>, less<>, allocator<std::pair<const string, basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>>') and 'object_t')
        JSON_IMPLEMENT_OPERATOR(<=>, // *NOPAD*
        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../single_include/nlohmann/json.hpp:22818:53: note: expanded from macro 'JSON_IMPLEMENT_OPERATOR'
                return (*lhs.m_data.m_value.object) op (*rhs.m_data.m_value.object);                                   \
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__threading_support:682:17: note: candidate function not viable: no known conversion from 'object_t' (aka 'map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char>>, void>, less<>, allocator<std::pair<const string, basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>>') to '__thread_id' for 1st argument
strong_ordering operator<=>(__thread_id __x, __thread_id __y) noexcept {
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__variant/monostate.h:32:49: note: candidate function not viable: no known conversion from 'object_t' (aka 'map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char>>, void>, less<>, allocator<std::pair<const string, basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>>') to 'monostate' for 1st argument
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(monostate, monostate) noexcept {
                                                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/system_error:481:1: note: candidate function not viable: no known conversion from 'object_t' (aka 'map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char>>, void>, less<>, allocator<std::pair<const string, basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>>') to 'const error_code' for 1st argument
operator<=>(const error_code& __x, const error_code& __y) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/system_error:489:1: note: candidate function not viable: no known conversion from 'object_t' (aka 'map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char>>, void>, less<>, allocator<std::pair<const string, basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>>') to 'const error_condition' for 1st argument
operator<=>(const error_condition& __x, const error_condition& __y) noexcept
^
../single_include/nlohmann/json.hpp:2894:34: note: candidate function not viable: no known conversion from 'object_t' (aka 'map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char>>, void>, less<>, allocator<std::pair<const string, basic_json<std::map, std::vector, string, bool, long long, unsigned long long, double, std::allocator, nlohmann::adl_serializer, vector<unsigned char, allocator<unsigned char>>, void>>>>') to 'const value_t' for 1st argument
    inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD*
                                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__utility/pair.h:444:1: note: candidate template ignored: could not match 'pair' against 'map'
operator<=>(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:288:1: note: candidate template ignored: could not match 'reverse_iterator' against 'map'
operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:288:1: note: candidate template ignored: could not match 'reverse_iterator' against 'map'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:566:1: note: candidate template ignored: could not match 'unique_ptr' against 'map'
operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:566:1: note: candidate template ignored: could not match 'unique_ptr' against 'map'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:658:1: note: candidate template ignored: could not match 'unique_ptr' against 'map'
operator<=>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:658:1: note: candidate template ignored: could not match 'unique_ptr' against 'map'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1374:1: note: candidate template ignored: could not match 'shared_ptr' against 'map'
operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1374:1: note: candidate template ignored: could not match 'shared_ptr' against 'map'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1483:1: note: candidate template ignored: could not match 'shared_ptr' against 'map'
operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1483:1: note: candidate template ignored: could not match 'shared_ptr' against 'map'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:1572:1: note: candidate template ignored: could not match 'tuple' against 'map'
operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:1572:1: note: candidate template ignored: could not match 'tuple' against 'map'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:784:1: note: candidate template ignored: could not match 'basic_string_view' against 'map'
operator<=>(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:797:38: note: candidate template ignored: could not match 'basic_string_view' against 'map'
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:797:38: note: candidate template ignored: could not match 'basic_string_view' against 'map'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/variant:1659:1: note: candidate template ignored: could not match 'variant' against 'map'
operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/move_iterator.h:282:6: note: candidate template ignored: could not match 'move_iterator' against 'map'
auto operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/move_iterator.h:282:6: note: candidate template ignored: could not match 'move_iterator' against 'map'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4077:38: note: candidate template ignored: could not match 'basic_string' against 'map'
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4085:1: note: candidate template ignored: could not match 'basic_string' against 'map'
operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4085:1: note: candidate template ignored: could not match 'basic_string' against 'map'
In file included from examples/operator_spaceship__const_reference.c++20.cpp:3:
../single_include/nlohmann/json.hpp:22948:33: error: invalid operands to binary expression ('binary_t' (aka 'byte_container_with_subtype<std::vector<unsigned char, std::allocator<unsigned char>>>') and 'binary_t')
        JSON_IMPLEMENT_OPERATOR(<=>, // *NOPAD*
        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../single_include/nlohmann/json.hpp:22839:53: note: expanded from macro 'JSON_IMPLEMENT_OPERATOR'
                return (*lhs.m_data.m_value.binary) op (*rhs.m_data.m_value.binary);                                   \
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__threading_support:682:17: note: candidate function not viable: no known conversion from 'binary_t' (aka 'byte_container_with_subtype<std::vector<unsigned char, std::allocator<unsigned char>>>') to '__thread_id' for 1st argument
strong_ordering operator<=>(__thread_id __x, __thread_id __y) noexcept {
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__variant/monostate.h:32:49: note: candidate function not viable: no known conversion from 'binary_t' (aka 'byte_container_with_subtype<std::vector<unsigned char, std::allocator<unsigned char>>>') to 'monostate' for 1st argument
_LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(monostate, monostate) noexcept {
                                                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/system_error:481:1: note: candidate function not viable: no known conversion from 'binary_t' (aka 'byte_container_with_subtype<std::vector<unsigned char, std::allocator<unsigned char>>>') to 'const error_code' for 1st argument
operator<=>(const error_code& __x, const error_code& __y) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/system_error:489:1: note: candidate function not viable: no known conversion from 'binary_t' (aka 'byte_container_with_subtype<std::vector<unsigned char, std::allocator<unsigned char>>>') to 'const error_condition' for 1st argument
operator<=>(const error_condition& __x, const error_condition& __y) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__utility/pair.h:444:1: note: candidate template ignored: could not match 'pair' against 'byte_container_with_subtype'
operator<=>(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:288:1: note: candidate template ignored: could not match 'reverse_iterator' against 'byte_container_with_subtype'
operator<=>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/reverse_iterator.h:288:1: note: candidate template ignored: could not match 'reverse_iterator' against 'byte_container_with_subtype'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:566:1: note: candidate template ignored: could not match 'unique_ptr' against 'byte_container_with_subtype'
operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:566:1: note: candidate template ignored: could not match 'unique_ptr' against 'byte_container_with_subtype'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:658:1: note: candidate template ignored: could not match 'unique_ptr' against 'byte_container_with_subtype'
operator<=>(const unique_ptr<_T1, _D1>& __x, nullptr_t) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:658:1: note: candidate template ignored: could not match 'unique_ptr' against 'byte_container_with_subtype'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1374:1: note: candidate template ignored: could not match 'shared_ptr' against 'byte_container_with_subtype'
operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1374:1: note: candidate template ignored: could not match 'shared_ptr' against 'byte_container_with_subtype'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1483:1: note: candidate template ignored: could not match 'shared_ptr' against 'byte_container_with_subtype'
operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/shared_ptr.h:1483:1: note: candidate template ignored: could not match 'shared_ptr' against 'byte_container_with_subtype'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:1572:1: note: candidate template ignored: could not match 'tuple' against 'byte_container_with_subtype'
operator<=>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:1572:1: note: candidate template ignored: could not match 'tuple' against 'byte_container_with_subtype'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:784:1: note: candidate template ignored: could not match 'basic_string_view' against 'byte_container_with_subtype'
operator<=>(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) noexcept {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:797:38: note: candidate template ignored: could not match 'basic_string_view' against 'byte_container_with_subtype'
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string_view:797:38: note: candidate template ignored: could not match 'basic_string_view' against 'byte_container_with_subtype'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/variant:1659:1: note: candidate template ignored: could not match 'variant' against 'byte_container_with_subtype'
operator<=>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/move_iterator.h:282:6: note: candidate template ignored: could not match 'move_iterator' against 'byte_container_with_subtype'
auto operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__iterator/move_iterator.h:282:6: note: candidate template ignored: could not match 'move_iterator' against 'byte_container_with_subtype'
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4077:38: note: candidate template ignored: could not match 'basic_string' against 'byte_container_with_subtype'
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(
                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4085:1: note: candidate template ignored: could not match 'basic_string' against 'byte_container_with_subtype'
operator<=>(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs) {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/string:4085:1: note: candidate template ignored: could not match 'basic_string' against 'byte_container_with_subtype'
3 errors generated.
make[1]: *** [examples/operator_spaceship__const_reference.c++20] Error 1
make: *** [examples/operator_spaceship__const_reference.c++20.output] Error 2

And with GCC 13:

❯ CXX=g++-13 make create_output                                       
standard 
/Library/Developer/CommandLineTools/usr/bin/make examples/operator_spaceship__const_reference.c++20 \
                CPPFLAGS="-I ../single_include -DJSON_USE_GLOBAL_UDLS=0 -DJSON_HAS_THREE_WAY_COMPARISON=1" \
                CXXFLAGS="-std=c++20 -Wno-deprecated-declarations"
g++-13 -std=c++20 -Wno-deprecated-declarations -I ../single_include -DJSON_USE_GLOBAL_UDLS=0 -DJSON_HAS_THREE_WAY_COMPARISON=1   examples/operator_spaceship__const_reference.c++20.cpp   -o examples/operator_spaceship__const_reference.c++20
ld: warning: ignoring duplicate libraries: '-lgcc'
0  0x101017648  __assert_rtn + 72
1  0x100f4bfac  ld::AtomPlacement::findAtom(unsigned char, unsigned long long, ld::AtomPlacement::AtomLoc const*&, long long&) const + 1204
2  0x100f61924  ld::InputFiles::SliceParser::parseObjectFile(mach_o::Header const*) const + 15164
3  0x100f6ee30  ld::InputFiles::parseAllFiles(void (ld::AtomFile const*) block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 420
4  0x183e8f950  _dispatch_client_callout2 + 20
5  0x183ea2ba0  _dispatch_apply_invoke + 176
6  0x183e8f910  _dispatch_client_callout + 20
7  0x183ea13cc  _dispatch_root_queue_drain + 864
8  0x183ea1a04  _dispatch_worker_thread2 + 156
9  0x1840390d8  _pthread_wqthread + 228
ld: Assertion failed: (resultIndex < sectData.atoms.size()), function findAtom, file Relocations.cpp, line 1336.
collect2: error: ld returned 1 exit status
make[1]: *** [examples/operator_spaceship__const_reference.c++20] Error 1
make: *** [examples/operator_spaceship__const_reference.c++20.output] Error 2

@ArsenArsen
Copy link
Contributor

seems that GCC discovered a bug in apple's ld there - 'fun'.

fwiw, I was testing against upstream llvm 17, so I'm not sure I can say what's going on on apple clang (but I suspect the <=> impl is incomplete, which'd be implied by the lack of the FTM, even in llvm 17)

sorry, I don't have an apple machine I could dig in further on :-/

I can post the output that GCC produced on my machine, if that helps, though

@nlohmann
Copy link
Owner Author

I really need help here. Beside yet another issue in the CI, this issue blocks the next release.

@ArsenArsen
Copy link
Contributor

iirc, this was due to apple clang using outdated libcxx, and libcxx (even newer versions) not having all of three_way_compare implemented. it worked on my system because we have recent enough libcxx in gentoo, so just telling json.h to ignore the FTM not existing worked well enough.

i'd either use gcc or newer clang and the workaround to get the release out

@crazyjul
Copy link
Contributor

crazyjul commented Dec 6, 2023

Unfortunately, @ArsenArsen is right. Currently those check are :

    #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L 

and

        && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L

The first one is true on macOS clang 15, as the compiler is supporting the operator.
But the second check is false, as the library does not support the operator yet, which is requires for basic_json class (as it forward <=> to std::vector

So the solutions are :

  • exclude the example from the doc when compiling on apple
  • use a custom clang (e.g. from brew )

Now if I understand right, the output is just used for diff testing, we could #if JSON_HAS_THREE_WAY_COMPARISON around the whole file, and fake the test

@crazyjul
Copy link
Contributor

crazyjul commented Dec 6, 2023

An example of faking for documentation

    #if JSON_HAS_THREE_WAY_COMPARISON

    // output values and comparisons
    std::cout << array_1 << " <=> " << array_2 << " := " << to_string(array_1 <=> array_2) << '\n'; // *NOPAD*
    std::cout << object_1 << " <=> " << object_2 << " := " << to_string(object_1 <=> object_2) << '\n'; // *NOPAD*
    std::cout << string << " <=> " << number << " := " << to_string(string <=> number) << '\n'; // *NOPAD*
    std::cout << string << " <=> " << discarded << " := " << to_string(string <=> discarded) << '\n'; // *NOPAD*

    #else

    // fake values and comparisons when compiler is not supporting
    std::cout << array_1 << " <=> " << array_2 << " := " << "less" << '\n'; // *NOPAD*
    std::cout << object_1 << " <=> " << object_2 << " := " << "equivalent" << '\n'; // *NOPAD*
    std::cout << string << " <=> " << number << " := " << "greater" << '\n'; // *NOPAD*
    std::cout << string << " <=> " << discarded << " := " << "unordered" << '\n'; // *NOPAD*

    #endif

@shubhk18
Copy link

shubhk18 commented Jan 6, 2024

writing definition explicitly for operator <=> is one of the solutions unless we want to wait for clang to include this definition for our consumption.

@Agasthya-Samyak-Jnan
Copy link

Hey there, this worked on my g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r2) 14.2.0 compiler perfectly and didn't create an error. The operator worked fine , and haven't done any changes to the code you have provided. I ran it on my Windows 10 Environment.

Here is the output.
PS C:\Users\Agasthya Samyak Jnan\JSON\json\docs\examples> ./operator_spaceship
[1,2,3] <=> [1,2,4] := less
{"A":"a","B":"b"} <=> {"A":"a","B":"b"} := equivalent
"foo" <=> 17 := greater
"foo" <=> := unordered

I think the issue is Apple Clang Compiler Specific?

I am a beginner, so I couldn't figure out much in this. Operator overloading was not needed since it worked for me directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug state: help needed the issue needs help to proceed
Projects
None yet
Development

No branches or pull requests

5 participants