← Back to index
|
Original Bugzilla link
Bug 22661 – Functions cannot be interpreted while being compiled
Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-01-09T15:11:53Z
Last change time
2024-12-13T19:20:20Z
Assigned to
No Owner
Creator
Tim
Moved to GitHub: dmd#20037 →
Comments
Comment #0
by tim.dlang — 2022-01-09T15:11:53Z
//////////////////// parent.d ///////////////////// import childb; import defs; class Parent { enum CONSTANT = defs.CONSTANT; } //////////////////// childa.d ///////////////////// import parent; import helpers; class ChildA : Parent { mixin(ctfeFunc(true)); } //////////////////// childb.d ///////////////////// import parent; import helpers; class ChildB : Parent { mixin(ctfeFunc()); } ///////////////////// defs.d ////////////////////// import childa; enum CONSTANT = ""; //////////////////// helpers.d //////////////////// string ctfeFunc(bool) { import std.ascii; return ""; } string ctfeFunc() { return ctfeFunc(false); } /////////////////////////////////////////////////// Compiling the above code with dmd -c parent.d results in the following error: helpers.d(1): Error: function `helpers.ctfeFunc` circular dependency. Functions cannot be interpreted while being compiled childa.d(5): called from here: `ctfeFunc(true)` helpers.d(8): called from here: `ctfeFunc(false)` childb.d(5): called from here: `ctfeFunc()`
Comment #1
by dfj1esp02 — 2022-01-10T10:47:59Z
Whoa, can this compile even in theory? Four modules import each other and you have a circular dependency between declaration stage and semantic stage.
Comment #2
by moonlightsentinel — 2022-01-10T12:23:47Z
This example compiles just fine with current dmd, see
https://run.dlang.io/is/9koFtR.
Comment #3
by tim.dlang — 2022-01-10T16:35:04Z
I can see the error on run.dlang.io, too, after adding the filename as an argument:
https://run.dlang.io/is/QmWZ9j
The error seems to depend on the order of files on the dmd command line.
Comment #4
by robert.schadek — 2024-12-13T19:20:20Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/20037
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB