https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50645
Eric Gallager <egallager at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED CC| |egallager at gcc dot gnu.org Resolution|--- |INVALID --- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to mike.c from comment #1) > The quick fix: > > #pragma GCC diagnostic ignored "-Wwrite-strings" > > ... of course eliminates the warnings -- but logically, you DO WANT A > WARNING when you should be declaring > > const char* (and you forget const) > > but LOGICALLY you don't want I warning when passing a string literal to a > char* parameter in a function. Related: bug 61579 (In reply to Jonathan Wakely from comment #5) > two points: > > 1) the component for this bug should surely be c++, since the "deprecated > conversion" warning is only issued by the C++ front end, the C front end says > > passing argument 1 of ‘myfunction’ discards ‘const’ qualifier from pointer > target type > > and even then, only with -Wwrite-strings, which is not enabled by -Wall > -Wextra > > 2) unlike the PR's summary, the warning says "deprecated conversion from > string CONSTANT to 'char*'" (emphasis mine) which should be a pretty big > clue that it's warning you about a real problem. > > I can't see any good reason this PR isn't INVALID, but will go for WAITING > in case you have a better case to make for changing the current behaviour, > which is entirely consistent with the C++ standard. Closing as INVALID then since reporter never came back and made a better case