writeln(Range) fails on 2.058
simendsjo
simendsjo at gmail.com
Wed Feb 15 02:10:45 PST 2012
On 02/15/2012 09:33 AM, simendsjo wrote:
> import std.array;
> import std.stdio;
>
> struct S
> {
> string txt;
>
> void popFront()
> {
> txt.popFront();
> }
>
> @property dchar front()
> {
> return txt.front;
> }
>
> @property bool empty()
> {
> return txt.empty;
> }
> }
>
> void main() {
> S s;
> writeln(s); // range.d(295): Error: static assert "Cannot put a S into a
> LockingTextWriter"
> }
>
> I haven't read the whole changelog yet, so this might not be a bug.
> Pretty convenient when it worked though..
Seems the issue is triggered by using *char front(). Other types still work.
import std.stdio;
struct S {
void popFront() { }
@property char front() {
return 'a';
}
@property bool empty() {
return false;
}
}
void main() {
writeln(S()); // range.d(295): Error: static assert "Cannot put a
S into a LockingTextWriter"
}
More information about the Digitalmars-d-learn
mailing list