https://bugs.llvm.org/show_bug.cgi?id=51874
Bug ID: 51874
Summary: [C++20] Wrongly worded warning on defaulted-as-deleted
operator!=
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++2a
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
// https://godbolt.org/z/GP1d8f5Kx
#include <compare>
struct C {
friend std::strong_ordering operator<=>(const C&, const C&);
bool operator!=(const C&) const = default;
};
<source>:5:8: warning: explicitly defaulted equality comparison operator is
implicitly deleted [-Wdefaulted-function-deleted]
bool operator!=(const C&) const = default;
^
<source>:5:8: note: defaulted 'operator!=' is implicitly deleted because there
is no viable three-way comparison function for 'C'
The compiler is right to diagnose this ill-formed program, but wrong to claim
that there is no viable "three-way comparison function".
GCC gives a more accurate diagnostic (but only at the point where the
defaulted-as-deleted function is actually called):
<source>:5:8: note: 'bool C::operator!=(const C&) const' is implicitly deleted
because the default definition would be ill-formed:
5 | bool operator!=(const C&) const = default;
| ^~~~~~~~
<source>:5:8: error: no match for 'operator==' (operand types are 'const C' and
'const C')
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs