Skip to content

[clang-tidy] More fine-grained options for readability-implicit-bool-conversion #63450

@chrchr-github

Description

@chrchr-github
enum E : long { E0, E1 };
E f();
bool g(int i, double d) {
    if (i) {}
    if (d) {}
    return f();
}

In the code above, three instances of readability-implicit-bool-conversion are detected. However, in some code bases, similar if conditions are very common and do not cause issues, whereas conversion from an enum might be a serious bug.
It would be nice to have more control over readability-implicit-bool-conversion warnings by either type involved (enum vs numerical) or usage (if vs return).

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-tidyenhancementImproving things as opposed to bug fixing, e.g. new or missing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions