https://bugs.llvm.org/show_bug.cgi?id=44325
Bug ID: 44325
Summary: Wzero-as-null-pointer-constant warns when using
`operator<=>`
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
```
#include <compare>
auto b = 1 <=> 2 < 0;
```
Outputs:
```
<source>:3:20: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]
auto b = 1 <=> 2 < 0;
^
nullptr
1 warning generated.
Compiler returned: 0
```
See it live: https://godbolt.org/z/9a8cnD
Technically, the warning is accurate. User code has a literal `0` that is being
passed to a function accepting a `nullptr`. However, this is an implementation
detail of the standard library and the intended interface for use (users should
not use `nullptr` there), so we should not warn users for doing so (and
definitely should not direct them to change their code).
--
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