After several years out of c++, I’m getting back into it and a lot has changed. I had to write an equality operator for a large struct the other day and was looking for something (maybe a generator) to write it for me and I came across a post mentioning c++ 20? would do this for free. So I grabbed a copy of Clang 8 and wrote this simple program but I cannot get it to compile. It fails with
error: only special member functions may be defaulted
#include
struct foo {
int x;
int operator<=>(const foo&)=default;
};
int main() {
foo f0 = {1}, f1 = {1};
std::cout << ((f0 <=> f1) == 0) << std::endl;
char ch;
std::cin >> ch;
}
Any help appreciated