Skip to content

clang could do a better job at warning for implicit conversion to bool #10531

@llvmbot

Description

@llvmbot
Bugzilla Link 10159
Version trunk
OS All
Blocks llvm/llvm-bugzilla-archive#22259
Reporter LLVM Bugzilla Contributor
CC @akyrtzi,@DougGregor,@seanm

Extended Description

MSVC will emit warnings for the following code, clang not:

enum E {
e = 3,
};

int main() {
bool var1 = e; // truncation from 'E' to 'bool'
bool var2 = 3; // truncation from 'int' to 'bool'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions