[llvm-bugs] [Bug 51874] New: [C++20] Wrongly worded warning on defaulted-as-deleted operator!=
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 15 13:12:10 PDT 2021
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: unassignedclangbugs at nondot.org
Reporter: arthur.j.odwyer at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
// 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210915/d95bf2dc/attachment.html>
More information about the llvm-bugs
mailing list