C++ PATCH: Consolidate division by zero warnings
Sat Apr 15 03:36:00 GMT 2006
Dirk Mueller wrote:
> I've noticed that the C and C++ frontends disagree about the "divison by zero"
> warning. The C frontend ignored it for real constants. Now the C++ frontend
> does too.
> Bootstrapped/regtested on i686-suse-linux. Ok for trunk?
I think this would be an incorrect change. [expr]/5 says that division
by zero in a constant-expression is ill-formed; therefore a diagnostic
is required on code like:
static const int i = int (0.0 / 0.0);
In the example you gave, no diagnostic is required by the standard, but
is still seems reasonable to give one, and we do not have a very easy
way of distinguishing the two cases.
(650) 331-3385 x713
More information about the Gcc-patches