Subject: Re: bug#40671: [DOC] modify literal objects

From: Dmitry Gutov <[email-masked]>
Date: Sun, 26 Apr 2020 17:34:56 +0300

On 26.04.2020 17:19, Eli Zaretskii wrote:
> Did you try compiling that as a C program, not a C++ program?

As C++.

 From what I understand, in C string literals are not "const", it's just 
UB to modify them.

> but even that goes away if I modify the program as follows:
> 
>    #include <string.h>
>    int main (void) { return !strcpy ((char *)"a", "b"); }

If you go out of your way to avoid warnings, then indeed, the compiler 
won't show them.

And typecasts are an easy way to turn compilation errors into runtime 
errors, in general.