C++ Logo

std-proposals

Advanced search

Re: nullptr_t and nullopt_t should both have operator<=> and operator== to enable the *_with concepts

From: Nevin Liber <nevin_at_[hidden]>
Date: Fri, 9 Jul 2021 18:24:37 -0500
Current state of the world <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

Received on 2021-07-09 18:25:18