'auto pure' is up, how about 'auto @safe'?

KennyTM~ kennytm at gmail.com
Mon Jun 20 02:42:55 PDT 2011


'auto pure' (actually, purity inference) has been integrated in commit 
'dfb68'*, Thanks Walter:

------------------------------
int y()(int x) {  // <-- pure is inferred for template function
     return 0;
}
void main() pure {
     y(2);
}
------------------------------



But I think it should be able to detect @safe as well:

------------------------------
int y()(int x) {
     return 0;
}
void main() @safe {
     y(2);
}
------------------------------
y.d(5): Error: safe function 'main' cannot call system function 'y'
------------------------------


*: https://github.com/D-Programming-Language/dmd/commit/dfb68


More information about the Digitalmars-d mailing list