[Issue 23652] New: Valid code rejected with a "circular reference" error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 24 11:46:17 UTC 2023


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

          Issue ID: 23652
           Summary: Valid code rejected with a "circular reference" error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: maxsamukha at gmail.com

struct DTB
{
    enum staticOverhead = DispatchTable!().sizeof;
}

struct DispatchTable()
{
    static assert (DTB.staticOverhead == typeof(this).sizeof);
}

Error: circular reference to variable `sc.tree.core.DTB.staticOverhead`


But the non-templated version compiles successfully:

struct DTB
{
    enum staticOverhead = DispatchTable.sizeof;
}

struct DispatchTable
{
    static assert (DTB.staticOverhead == typeof(this).sizeof);
}

--


More information about the Digitalmars-d-bugs mailing list