rsmith added a comment.
I don't think this change is right: for
struct A {
int &r;
bool operator==(const A&) const = default;
};
we should warn about the reference member (as we do), but for
struct A {
int &r;
bool operator<(const A&) const = default;
};
... we shouldn't recurse to subobjects because they make no difference. The
problem in that example is that there's no `operator<=>` for `A`; the fact that
there's a reference member is irrelevant. I think it would be useful to change
the diagnostic from
<stdin>:3:8: warning: explicitly defaulted relational comparison operator is
implicitly deleted [-Wdefaulted-function-deleted]
bool operator<(const A &) const = default;
^
<stdin>:3:8: note: defaulted 'operator<' is implicitly deleted because there
is no viable comparison function
to something more verbose, such as
<stdin>:3:8: warning: explicitly defaulted relational comparison operator is
implicitly deleted [-Wdefaulted-function-deleted]
bool operator<(const A &) const = default;
^
<stdin>:3:8: note: defaulted 'operator<' is implicitly deleted because there
is no viable three-way comparison function for 'A'
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97990/new/
https://reviews.llvm.org/D97990
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits