Skip to content

readability-implicit-bool-conversion suggestion causes new readability-uppercase-literal-suffix warning #40544

@llvmbot

Description

@llvmbot
Bugzilla Link 41199
Version unspecified
OS Linux
Attachments Example cpp file to reproduce the error
Reporter LLVM Bugzilla Contributor
CC @chfast,@EugeneZelenko

Extended Description

When I run

clang-tidy --checks="readability-*" -fix-errors example.cpp --

on the attached file, I get the following output:

1 warning generated.
example.cpp:3:9: warning: implicit conversion 'unsigned int' -> bool [readability-implicit-bool-conversion]
if (s) {
^
!= 0u
example.cpp:3:10: note: FIX-IT applied suggested code changes
if (s) {
^
clang-tidy applied 1 of 1 suggested fixes.

However, adding the '!= 0u' causes a new warning, when I re-run the checks:

clang-tidy --checks="readability-*" example.cpp --

1 warning generated.
example.cpp:3:14: warning: integer literal has suffix 'u', which is not uppercase [readability-uppercase-literal-suffix]
if (s != 0u) {
^~
U

It would be better if clang-tidy suggests an uppercase suffix (i.e., '!= 0U') in the first place.

clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 8.0.0
Optimized build.
Default target: x86_64-unknown-linux-gnu
Host CPU: skylake

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang-tidygood first issuehttps://github.com/llvm/llvm-project/contribute

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions