Bug 22794 – Compile-time format validation gives unhelpful error on too many arguments
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-02-20T10:07:05Z
Last change time
2022-12-17T16:33:49Z
Assigned to
No Owner
Creator
JR
Comments
Comment #0 by zorael — 2022-02-20T10:07:05Z
Manjaro/Arch x86_&4, dmd 2.098.1.
```d
import std.stdio;
void main()
{
writefln!"%s"("a", "b");
}
```
>/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d(4442): Error: no property `msg` for type `string`
>/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d(4442): Error: static assert: __error
>onlineapp.d(4): instantiated from here: `writefln!("%s", string, string)`
https://run.dlang.io/is/fQ9GtQ
Comment #1 by nick — 2022-09-05T17:25:22Z
run.dlang.io gives:
/dlang/dmd/linux/bin64/../../src/phobos/std/stdio.d(4432): Error: static assert: "Orphan format arguments: args[1..2]"
onlineapp.d(5): instantiated from here: `writefln!("%s", string, string)`
I also get that with dmd v2.100.2-beta.1-dirty.