Skip to content

hicpp-use-nullptr does not make sense with spaceship operator #45580

Closed
@pavelkryukov

Description

@pavelkryukov
Bugzilla Link 46235
Resolution FIXED
Resolved on Feb 09, 2021 14:27
Version unspecified
OS All
CC @dermojo,@maxim-banaev
Fixed by commit(s) 98146c1

Extended Description

Hello

With the following input:

#include

struct A {
int a;
constexpr auto operator<=>(const A&) const = default;
};

bool foo(A x, A y) { return x < y; }

and command line:

clang-tidy-10 -checks='hicpp-use-nullptr' tidy20.cpp -- -std=c++20

Clang-Tidy generates following output which does not make sense:

./tidy20.cpp:5:56: warning: use nullptr [hicpp-use-nullptr]
constexpr auto operator<=>(const A&) const = default;
^
nullptr
./tidy20.cpp:8:31: warning: use nullptr [hicpp-use-nullptr]
bool foo(A x, A y) { return x < y; }
^
nullptr

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions