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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to