Need an opinion from C++ folks
Jason Merrill
jason@cygnus.com
Wed Oct 28 18:51:00 GMT 1998
>>>>> Mark Mitchell <mark@markmitchell.com> writes:
> The bug is that the first call is accepted. String literals are of
> type `const char [n]' where n is the number of characters, including
> the trailing '\0'. I suspect that there is some leniency code in the
> compiler that allows the first call, but not the second.
Nope, this is what the standard specifies.
4.2 - Array-to-pointer conversion [conv.array]
-2- A string literal (lex.string) that is not a wide string literal can be
converted to an rvalue of type `pointer to char''; a wide string literal
can be converted to an rvalue of type `pointer to wchar_t''.
Given this situation, we may want to revert your patch promoting
the const-incorrectness diagnostics to errors.
Jason
More information about the Gcc-bugs
mailing list