-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang: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 analyzer
Description
| Bugzilla Link | 12646 |
| Version | trunk |
| OS | All |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor,@zygoloid |
Extended Description
Compiling the following with [clang++ -Wsign-compare -c] (trunk 155352) results in warnings for the first i==u comparison and then for all the comparisons in g(). I believe the other comparisons in f() should also trigger the warning, for consistency (but they appear not too, presumably because of the "const"s).
int f() {
int i = 1;
const int ci = 2;
unsigned u = 3;
const unsigned cu = 4;
if (i == u) return 1; // Only this triggers a warning!
if (ci == cu) return 2;
if (i == cu) return 3;
if (ci == u) return 4;
return 0;
}
int bar();
int g() {
int i = bar();
const int ci = bar();
unsigned u = bar();
const unsigned cu = bar();
if (i == u) return 1;
if (ci == cu) return 2;
if (i == cu) return 3;
if (ci == u) return 4;
return 0;
}
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang: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 analyzer