<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Wzero-as-null-pointer-constant when using defaulted operator<=>"
href="https://bugs.llvm.org/show_bug.cgi?id=50877">50877</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wzero-as-null-pointer-constant when using defaulted operator<=>
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++2a
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mike.winterberg@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24983" name="attach_24983" title="possible patch for the problem">attachment 24983</a> <a href="attachment.cgi?id=24983&action=edit" title="possible patch for the problem">[details]</a></span>
possible patch for the problem
See bug <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - Wzero-as-null-pointer-constant warns when using `operator<=>`"
href="show_bug.cgi?id=44325">https://bugs.llvm.org/show_bug.cgi?id=44325</a> for what is happening that
produces the 0 -> nullptr conversion.
Compiling this code with -Wzero-as-null-pointer-constant
#include <compare>
struct Point {
int x{}, y{}, z{};
auto operator<=>(const Point&) const = default;
};
int main() {
return Point{} < Point{};
}
Produces three -Wzero-as-null-pointer-constant warnings, one for each member of
Point. Fortunately suppressing the warning at the implementation site of
operator<=> suppresses it for users.
Live example: <a href="https://gcc.godbolt.org/z/3n9Kf3baa">https://gcc.godbolt.org/z/3n9Kf3baa</a>
The fix is seemingly very close the fix to #44325, but the build environment I
have that can build clang doesn't have "enough" to actually run the tests so I
don't know if my possible fix ends up suppressing the warning in other cases.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>