mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-08 11:56:12 +03:00
23 lines
358 B
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);
|
|
}
|