On Tue, Sep 01, 2026 at 04:19:34PM +0000, Joseph Myers wrote: > On Tue, 1 Sep 2026, Martin Uecker wrote: > > > > I think -Wwrite-strings has been around for so long with its current > > > semantics that it should be considered a semantic option that changes the > > > type of string literals, despite its -W name; anything that does not > > > change the type should be named differently. (This does not prevent > > > giving more precise diagnostics with -Wwrite-strings in the specific case > > > of string literals, as long as they are consistent with still having > > > const-qualified types - for example, as long as they remain pedwarns and > > > typeof produces the const-qualified types.) > > > > How about doing it the other way around: Instead of > > -fconst-string-literals turning on -Wwrite-strings we > > have -Wwrite-strings turn on -fconst-string-literals? Then the > > behavior with just -Wwrite-strings remains the same as it always > > was, but one can independently toggle it using > > -fconst-string-literals (which then overwrites the default)? > > That seems reasonable (thus, with -Wwrite-strings > -fno-const-string-literals as being the pure warning that does not change > types and produces warnings rather than pedwarns).
Can we please just fix the bug? I can't see any code legitimately depending on -Wwrite-strings breaking language semantics. Someone who wants to use the warning should not need to know they need to couple it with -fno-const-string-literals to get the right behavior. Rich
