const int bob = 0;
if(bob)
{
int fred = 6/bob;
}
you will get an error on the line where the divide is done: "error C2124: divide or mod by zero"
which is lame, because it is just as inevitable that the 'if' check will fail, as it is the divide will result in a div by 0. quite frankly I see no reason for the compiler to even evaluate anything in the 'if', except to assure brace integrity.
anyway, obviously that example isn't my problem, my problem comes when doing complicated template stuff to try and do as much at compile time as possible, in some cases arguments may be 0.
is there anyway to fix this error? or disable it? or any better workarounds than this:
currently the only work around I can think of (which I've done before when I encountered the same problem with recursive enum access) is to use template specialization to do the 'if'.
Oh yeah, I'm using Visual Studio Professional 2005 SP1 with the vista/win7 fix.