Apple's clang can't use <=> with std::tuple

Viewed 56

The following compiles fine with GCC and clang on on godbolt, but on my MacBook, in Xcode 14 it dies:

#include <iostream>
#include <compare>
#include <tuple>

using std::cout; using std::tuple; using std::endl;

int main() {
    tuple<float, float> tuplee = {1.0,2.0};
    tuple<float, float> tuploo = {3.0,4.0};
    cout << (tuplee < tuploo) << endl;
    auto res = (tuplee <=> tuploo);
    cout << (res < 0) << endl;
    return 0;
}

The error is:

invalid operands to binary expression ('std::tuple<float, float>' and 'std::tuple<float, float>')

It points to the <=> on the tuples. Do you think it's a bug in Apple's clang, or am I missing something?

Command line on my MacBook:

% clang++ --version          
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
% clang++ -std=c++2b main.cpp
main.cpp:11:21: error: invalid operands to binary expression ('tuple<float, float>' and 'tuple<float, float>')
    cout << (tuplee <=> tuploo) << endl;
             ~~~~~~ ^   ~~~~~~
1 error generated.
0 Answers
Related