ldc/tests/codegen/gh1728.d

23 lines
358 B
D

// RUN: %ldc -run %s
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() {
OpApply range;
const s = Bolinha(range);
assert(s.a == 42);
}