[Issue 22661] New: Functions cannot be interpreted while being compiled

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 9 15:11:53 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22661

          Issue ID: 22661
           Summary: Functions cannot be interpreted while being compiled
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: tim.dlang at t-online.de

//////////////////// 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()`

--


More information about the Digitalmars-d-bugs mailing list