https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99701

            Bug ID: 99701
           Summary: std::nullptr_t can be compared with relational ops
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cjdb.ns at gmail dot com
  Target Milestone: ---

Created attachment 50443
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50443&action=edit
Temp file for provided source

The following program is valid in all versions of GCC from 4.7.1 through
trunk[1]. Relational operations on std::nullptr_t don't really make sense since
there's only one value.

```
auto lt = nullptr < nullptr;
auto gt = nullptr > nullptr;
auto le = nullptr <= nullptr;
auto ge = nullptr >= nullptr;
```

This was apparently addressed by DR583/N3478 (thanks to Richard Smith for
providing these).

[1]: https://godbolt.org/z/h11183

# Versions

* All GCC releases at least as far back as 4.7.1 (where I stopped looking).

# System type

* Debian (checked GCC 10.2.1)
* Compiler Explorer (checked all other reported versions).

# Options given to GCC

`g++ -save-temps nullptr-relop.cpp -c -std=c++20`

Reply via email to