Bug 7205 – Function attribute inference fails in case of mutual dependencies

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-02T14:07:28Z
Last change time
2024-12-13T17:57:31Z
Keywords
rejects-valid, spec
Assigned to
No Owner
Creator
timon.gehr
Moved to GitHub: dmd#18393 →

Comments

Comment #0 by timon.gehr — 2012-01-02T14:07:28Z
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. ***
Comment #5 by bugzilla — 2024-08-30T23:12:14Z
Comment #6 by robert.schadek — 2024-12-13T17:57:31Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18393 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB