-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaconfirmedVerified by a second partyVerified by a second partylibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Description
Bugzilla Link | 44325 |
Version | unspecified |
OS | Linux |
CC | @adrianimboden,@dwblaikie,@0x8000-0000,@dvhwgumby,@mclow,@mwinterb,@mizvekov,@zygoloid,@Weverything |
Fixed by commit(s) | 1f06f41, 678c259 |
Extended Description
#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).
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaconfirmedVerified by a second partyVerified by a second partylibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.