> Hi Manual, > > This needs to be handled in the front-ends, and in fact is already handled ^^^^^ should > by the front-ends. In c-typeck.c:build_binary_op, I see: > > case TRUNC_DIV_EXPR: > case CEIL_DIV_EXPR: > case FLOOR_DIV_EXPR: > case ROUND_DIV_EXPR: > case EXACT_DIV_EXPR: > /* Floating point division by zero is a legitimate way to obtain > infinities and NaNs. */ > if (skip_evaluation == 0 && integer_zerop (op1)) > warning (OPT_Wdiv_by_zero, "division by zero"); > > Likewise, there are several references to OPT_Wdiv_by_zero in cp/typeck.c. > The real issue is that OPT_Wdiv_by_zero needs to be enabled by -pedantic > in order to generate an error for -pedantic-errors, as requested by > Joseph in comment #1.
Actually it is only a diagnostic problem if we are in a constant expression. Thanks, Andrew Pinski