You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import std.stdio;
struct OpApply {
int opApply(int delegate(int) cb) {
return cb(42);
}
}
struct Bolinha {
int a;
this(ref OpApply moviadao) {
foreach(int b; moviadao) {
this.a = b;
return;
}
}
};
void main() {
import std.stdio;
OpApply range;writeln(Bolinha(range).a);
}
The expected print result was 42. But I get a random memory garbage instead. The following minor modification in main will 'fix' the issue:
void main() {
import std.stdio;
OpApply range;Bolinha littleBall = Bolinha(range);writeln(littleBall.a);
}
The text was updated successfully, but these errors were encountered:
André Puel reported this on 2016-08-31T17:45:38Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=16454
CC List
Description
import std.stdio; struct OpApply { int opApply(int delegate(int) cb) { return cb(42); } } struct Bolinha { int a; this(ref OpApply moviadao) { foreach(int b; moviadao) { this.a = b; return; } } }; void main() { import std.stdio; OpApply range; writeln(Bolinha(range).a); } The expected print result was 42. But I get a random memory garbage instead. The following minor modification in main will 'fix' the issue: void main() { import std.stdio; OpApply range; Bolinha littleBall = Bolinha(range); writeln(littleBall.a); }The text was updated successfully, but these errors were encountered: