http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53462
Bug #: 53462
Summary: template method constant folding division-by-zero
warning within dead code
Classification: Unclassified
Product: gcc
Version: 4.4.6
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
This code:
#include <stdio.h>
template <int I> struct foo {
static void bar() {
if (I && 10/I > 2) {
printf("Hello world\n");
}
}
};
int main(int, char**) {
foo<0>::bar();
return(0);
}
yields:
/tmp/t.cc: In static member function ‘static void foo<I>::bar() [with int I =
0]’:
/tmp/t.cc:10: instantiated from here
/tmp/t.cc:4: warning: division by zero
(but the division by zero is protected).