d接口和域问题
struct S {
int x;
}
@safe
interface I {
int func(ref scope S s) @nogc;
}
@safe
class C : I {
int func(ref S s) {
return 2*s.x;
}
}
编译器未检查域属性?
可编译,但问题是,接口函数有个(refscopeS)参数,而类实现为(refS).用dip25和dip1000应编译.问题是有时会导致段错误.编译器似乎不同对待他们.注意,C.func好像也有@nogc,自适应?
浙公网安备 33010602011771号