http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45918
Summary: Lack of warning on meaningless unsigned to zero
comparison
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
In this case idx<NUM-1 is always false.
gcc should issue an error: comparison is always false due to the value range
limitations.
--- testcase ---
typedef unsigned size_t;
template<size_t NUM>
struct G {
void fn();
};
template<size_t NUM>
void G<NUM>::fn() {
for (size_t idx = 0; idx<NUM-1; idx++) {
}
}
template struct G<1>;