On 15/01/07, Roger Sayle <[EMAIL PROTECTED]> wrote:
The second issue is that there are two different overflow related warnings. The first warning indicates that an overflow has occurred in an expression, and the second is that the overflowed result is used in a context required to be a compile-time constant. Apparently, the latter is more serious than the first, as an expression that overflows isn't considered a "constant" according to the/some standard.
int main() { wchar_t wc = ((wchar_t)1 << 31) - 1; } Excuse me if I am wrong but, does the initialization of wc really needs to be constant here? This is not the pedwarn emitted by c-common.c (constant_expression_warning). This is a warning emitted by c-common.c (convert_and_check). I am not sure if you were referring to the former or the latter. The difference is that in convert_and_check, the call to convert returns a tree with TREE_OVERFLOW set for C++ but not set for C. Anyhow I still find it odd that we emit two warnings. Cheers, Manuel.