Tested with DMD 2.057.
void foo()(){bar();}
void bar()(){foo();}
void qux() @safe pure nothrow{foo();}
Error: pure function 'qux' cannot call impure function 'foo'
Error: safe function 'qux' cannot call system function 'foo'
Error: foo is not nothrow
Error: function tt.qux 'qux' is nothrow yet may throw
The code should compile.
Comment #1 by timon.gehr — 2012-06-27T05:10:28Z
Apparently the spec has been changed to document the buggy behaviour.
function.html:
"Cyclic functions (i.e. functions that wind up directly or indirectly calling themselves) are inferred as being impure, throwing, and @system."
Therefore this is now both a spec and a compiler bug.
Comment #2 by snarwin+bugzilla — 2020-06-05T16:01:51Z
*** Issue 20724 has been marked as a duplicate of this issue. ***
Comment #3 by dkorpel — 2022-10-14T13:58:40Z
*** Issue 16528 has been marked as a duplicate of this issue. ***
Comment #4 by dkorpel — 2024-08-27T11:07:12Z
*** Issue 21681 has been marked as a duplicate of this issue. ***