Bug 23590 – Deprecation: scope variable 'bar' assigned to non-scope parameter '_param_2' calling formattedWrite

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-12-29T23:41:05Z
Last change time
2024-12-13T19:26:32Z
Assigned to
No Owner
Creator
elpenguino+D
Moved to GitHub: dmd#20209 →

Comments

Comment #0 by elpenguino+D — 2022-12-29T23:41:05Z
``` import std.format; void foo(scope immutable(char)[][] bar) @safe { static struct Result { void put(char c) @safe {} } Result().formattedWrite("%s", bar); } ``` The interesting thing about this code is that the deprecation vanishes if bar is `scope immutable(ubyte)[][]` instead. Copying formattedWrite into this module seems to make the warning go away as well, so I wasn't able to reduce this example any further.
Comment #1 by snarwin+bugzilla — 2023-03-02T19:30:09Z
Tested this with DMD/Phobos master and it compiles with no errors, so this should be fixed in the 2.103.0 release.
Comment #2 by robert.schadek — 2024-12-13T19:26:32Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20209 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB