H
Harald van Dijk
Harald said:... snip ...
(However, even without -Wwrite-strings, gcc has a bug in which the
equally strictly conforming
int main(void) {
if (0) ""[0] = 'x';
}
is unconditionally rejected.)
Not a bug. "" is a constant string, stored in (possibly) constant
memory, and thus is not writable. You may be complaining that gcc
hasn't bother to notice that the statment won't be executed, and thus
should suppress the message. However, compilers are allowed to emit all
the messages they wish.
I am complaining not that GCC warns about this program (which would be
conforming), but that it issues an error message and refuses to compile
it at all, in all non-conforming, mostly-conforming, and conforming
modes. I posted quite clearly that the program was "unconditionally
rejected". If it got compiled, with or without warnings, it would have
been accepted.