Skip to content

[clang-tidy] modernize-use-integer-sign-comparison fix-it inserts unbalanced parenthesis #162981

@localspook

Description

@localspook

This:

unsigned short u = 0;
short s = 0;
if (static_cast<unsigned int>(u) < static_cast<int>(s))
    return 0;

becomes

unsigned short u = 0;
short s = 0;
if (std::cmp_less(u,s))) // <- Should only be 2 closing parentheses
    return 0;

Godbolt

Found as part of #162851.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-tidyinvalid-code-generationTool (e.g. clang-format) produced invalid code that no longer compiles

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions