[Issue 9489] New: writeln of scoped class instance
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Feb 9 04:52:59 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9489
Summary: writeln of scoped class instance
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-02-09 04:52:58 PST ---
import std.stdio: writeln;
import std.conv: text;
import std.typecons: scoped;
class Foo {
int x;
this(int x_) { this.x = x_; }
override string toString() { return text(x); }
}
void main() {
auto f = scoped!Foo(100);
writeln(f.x); // OK
writeln(f); // Error
typeof(scoped!Foo(1))[10] foos;
foreach (i, ref fi; foos)
fi.x = i * 10;
writeln(foos); // Error
}
dmd 2.062beta gives:
...\dmd2\src\phobos\std\stdio.d(709): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
...\dmd2\src\phobos\std\format.d(414): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
...\dmd2\src\phobos\std\format.d(437): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
...\dmd2\src\phobos\std\format.d(451): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
...\dmd2\src\phobos\std\format.d(463): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
...\dmd2\src\phobos\std\format.d(475): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
...\dmd2\src\phobos\std\format.d(489): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
...\dmd2\src\phobos\std\format.d(498): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
...\dmd2\src\phobos\std\stdio.d(714): Error: template instance
std.format.formattedWrite!(LockingTextWriter, char, Scoped!(Foo)) error
instantiating
...\dmd2\src\phobos\std\stdio.d(1620): instantiated from here:
write!(Scoped!(Foo),char)
temp.d(12): instantiated from here: writeln!(Scoped!(Foo))
...\dmd2\src\phobos\std\stdio.d(714): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
...\dmd2\src\phobos\std\stdio.d(1620): Error: template instance
std.stdio.File.write!(Scoped!(Foo),char) error instantiating
temp.d(12): instantiated from here: writeln!(Scoped!(Foo))
...\dmd2\src\phobos\std\stdio.d(1620): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
temp.d(12): Error: template instance std.stdio.writeln!(Scoped!(Foo)) error
instantiating
temp.d(12): Error: struct std.typecons.scoped!(Foo,
int).scoped.Scoped!(Foo).Scoped is not copyable because it is annotated with
@disable
...\dmd2\src\phobos\std\format.d(1821): Error: static assert
(isInputRange!(Scoped!(Foo)[])) is false
...\dmd2\src\phobos\std\format.d(1789): instantiated from here:
formatValue!(LockingTextWriter, Scoped!(Foo)[], char)
...\dmd2\src\phobos\std\format.d(2953): instantiated from here:
formatValue!(LockingTextWriter, Scoped!(Foo)[10u], char)
...\dmd2\src\phobos\std\format.d(416): instantiated from here:
formatGeneric!(LockingTextWriter, Scoped!(Foo)[10u], char)
...\dmd2\src\phobos\std\stdio.d(735): ... (1 instantiations, -v to show)
...
...\dmd2\src\phobos\std\stdio.d(1620): instantiated from here:
write!(Scoped!(Foo)[10u],char)
temp.d(16): instantiated from here: writeln!(Scoped!(Foo)[10u])
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list