[llvm-bugs] [Bug 46803] New: Three way comparator complains "zero as null pointer constant"
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jul 21 23:37:55 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46803
Bug ID: 46803
Summary: Three way comparator complains "zero as null pointer
constant"
Product: clang
Version: 10.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: gumby at henkel-wallace.org
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
Bug in clang++10.0.1 libc++ installed via apt-get from your repo.
Identical on MacOS 10.15 with homebrew clang++10
Or Godbolt.
Compile following program doing `clang++-10 -std=c++20
-Wzero-as-null-pointer-constant`
#include <iostream>
#include <compare>
int main () {
bool result { (1 <=> 2) < 0 };
std::cout << (result ? "Yes" : "No") << std::endl;
}
produces the error:
foo.cc:5:27: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]
Also compiler-synthesized comparisons will generate this which is especially
confusing as they can happen when calling a library function that needs the '<'
operator.
--
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/20200722/9e1fa000/attachment-0001.html>
More information about the llvm-bugs
mailing list