[llvm-bugs] [Bug 48281] New: defaulted operator<=> triggers -Wzero-as-null-pointer-constant

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 24 04:26:24 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48281

            Bug ID: 48281
           Summary: defaulted operator<=> triggers
                    -Wzero-as-null-pointer-constant
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Georg.schwab at emocean.io
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 24201
  --> https://bugs.llvm.org/attachment.cgi?id=24201&action=edit
Compile using "clang++ -std=c++20"

Comparing two objects of a class or strut using <, >, <=, or >= results in the
warning "zero as null pointer constant" if the class has a defaulted
operator<=> (either friend or member).

To reproduce, compile the attached file with "clang++ -std=c++20"

Tested on Ubuntu 20.04 on WSL, using clang-11 package from
http://apt.llvm.org/focal/:

> clang++ -version
Ubuntu clang version
11.0.1-++20201121072613+973b95e0a84-1~exp1~20201121063226.132
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

-- 
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/20201124/a62869cd/attachment.html>


More information about the llvm-bugs mailing list