-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzergood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute
Description
| Bugzilla Link | 34180 |
| Version | unspecified |
| OS | Linux |
| CC | @m4tx,@zygoloid |
Extended Description
bool f(int x) {
return x = 0;
}
GCC gives:
This would have caught a bug in r310794 (https://reviews.llvm.org/rL310794)
I don't know for sure, but from the reduced test case, it seems that GCC is just seeing when an assignment is used in a bool-typed context? E.g. just bool(x = 0) seems to trigger it. https://godbolt.org/g/HyBZHM
Looking at the two examples, it looks like ImplicitCastExpr to bool is probably the thing to look for.
ImplicitCastExpr 0x4fce318 <col:12, col:16> '_Bool'
ImplicitCastExpr 0x4fce578 <col:17, col:21> '_Bool'
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzergood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute