https://bugs.llvm.org/show_bug.cgi?id=50877
Bug ID: 50877
Summary: Wzero-as-null-pointer-constant when using defaulted
operator<=>
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Created attachment 24983
--> https://bugs.llvm.org/attachment.cgi?id=24983&action=edit
possible patch for the problem
See bug https://bugs.llvm.org/show_bug.cgi?id=44325 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: https://gcc.godbolt.org/z/3n9Kf3baa
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.
--
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