[Issue 20632] Format and writeln not usable with non-copyable types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 4 02:07:19 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20632

--- Comment #1 from Mathias LANG <pro.mathias.lang at gmail.com> ---
Note that the errors I'm getting right now, without the `toString`, are:
```
/usr/local/opt/dmd/include/dlang/dmd/std/stdio.d(1505): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(4813): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(494): Error: template
instance std.format.getNthInt!("integer width", MyStruct) error instantiating
/usr/local/opt/dmd/include/dlang/dmd/std/stdio.d(1512):        instantiated
from here: formattedWrite!(LockingTextWriter, char, MyStruct)
/usr/local/opt/dmd/include/dlang/dmd/std/stdio.d(3870):        instantiated
from here: write!(MyStruct, char)
foo.d(15):        instantiated from here: writeln!(MyStruct)
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(494): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(508): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(4813): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(520): Error: template
instance std.format.getNthInt!("integer precision", MyStruct) error
instantiating
/usr/local/opt/dmd/include/dlang/dmd/std/stdio.d(1512):        instantiated
from here: formattedWrite!(LockingTextWriter, char, MyStruct)
/usr/local/opt/dmd/include/dlang/dmd/std/stdio.d(3870):        instantiated
from here: write!(MyStruct, char)
foo.d(15):        instantiated from here: writeln!(MyStruct)
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(520): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(531): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(4813): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(540): Error: template
instance std.format.getNthInt!("separator digit width", MyStruct) error
instantiating
/usr/local/opt/dmd/include/dlang/dmd/std/stdio.d(1512):        instantiated
from here: formattedWrite!(LockingTextWriter, char, MyStruct)
/usr/local/opt/dmd/include/dlang/dmd/std/stdio.d(3870):        instantiated
from here: write!(MyStruct, char)
foo.d(15):        instantiated from here: writeln!(MyStruct)
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(540): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/format.d(548): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/stdio.d(1512): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
/usr/local/opt/dmd/include/dlang/dmd/std/stdio.d(3870): Error: struct
foo.MyStruct is not copyable because it is annotated with @disable
foo.d(15): Error: struct foo.MyStruct is not copyable because it is annotated
with @disable
```

--


More information about the Digitalmars-d-bugs mailing list