Skip to content

[clang-tidy] readability implicit bool conversion applies wrong fix in ternary operator  #71867

@felix642

Description

@felix642

When running readability-implicit-bool-conversion on this code we get an invalid fix.

int main()
{
    bool bar = true ? 1 : false;
} 

Suggested fix:

int main()
{
    bool bar = true ? 1 : 0 != 0;
} 

godbolt: https://godbolt.org/z/vPj5exrTv

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions