Mark Mitchell wrote:-
However, while that may be necessary for Java, it's not necessary for C++. In C++, fold should only be called for "integral constant expressions", which, by definition, are made up of simple operations on integers. (It's a little more complicated than that, but all the operands collapse to integers immediately.) So, all we really need for C++ is the ability to convert floating-point constants to integer constants, and the ability to do basic arithmetic on integer constants.
I think it's desirable for front-ends to be able to fold floating point constant expressions too, no? It can be handy for diagnostics such as detecting overflow or unreachable code based on conditionals whose expression is a floating one, albeit constant.
Yes, that's useful -- but it's not actually *necessary* for a conforming C++ compiler to be able to fold floating-point constants.
-- Mark Mitchell CodeSourcery, LLC [EMAIL PROTECTED] (916) 791-8304