I attempted to address these issues in the attached updated draft. It adds many more diffs to the Tony Table, talks about N2478, briefly discusses the odd nature of requiring equality_comparable<U> for equality_comparable_with<T, U>, and includes a few minor changes (adding SG9, uses a hidden friend for the defaulted operator<=>, borrows the wording prior to N2478 for nullptr comparisons).

On the Tony Tables: it turns out that without the templates, many of the examples are trivially fixed by converting nullopt -> std::optional<int>() or nullptr -> std::shared_ptr<int>(). With templates, suddenly the information of precisely what optional or what smart_ptr was used becomes hidden, so we have to spend effort to recover that information. So the templates in fact show some cases with a bigger impact. However, even without the templates, it can turn out to be more readable to use the nullfoo variants instead of default constructed types.

Thanks,
Justin

On Fri, Jul 9, 2021 at 11:01 PM Jens Maurer via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On 10/07/2021 01.24, Nevin Liber via Std-Proposals wrote:
> Current state of the world <https://godbolt.org/z/7vcdMdjTe <https://godbolt.org/z/7vcdMdjTe>>:
>
>     char* p = nullptr;
>
>     static_cast<void>(p < nullptr);                         // invalid
>     static_cast<void>(std::less<>()(p, nullptr));           // valid on clang 12; invalid on gcc 11
>     static_cast<void>(std::less<char*>()(p, nullptr));      // valid
>     static_cast<void>(std::unique_ptr<char*>() < nullptr);  // valid
>     static_cast<void>(std::shared_ptr<char*>() < nullptr);  // valid

Ignoring the argument that std::less represents a total order on pointers
(but there is no such thing for raw pointer comparisons), this feels a
bit like the std::string(nullptr) discussion:

We made std::string(nullptr) ill-formed, but std::string((char*)0)
continues to be well-formed (necessarily) and has undefined behavior.

See P2166R1 A Proposal to Prohibit std::basic_string and
std::basic_string_view construction from nullptr,
adopted in the most recent plenary.

Jens
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals