www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21818] New: ICE: Assertion hit in dinterpret.d

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

          Issue ID: 21818
           Summary: ICE: Assertion hit in dinterpret.d
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: johanengelen weka.io

The testcase below compiles fine with normal compiler builds (assertions
disabled), but triggers the assertion in dinterpret.d on line 7362 (dlang
2.095) for debug compiler builds.
https://github.com/dlang/dmd/blob/f6188d5cd620aca785d211570bf2bf2fb21679ba/src/dmd/dinterpret.d#L7362


I've tried to minimize the testcase, but it requires Phobos's format, and
that's where I stopped:

```
import std.format;

void foo(bool, A.Info args) {
    format!"%s"(args);
}


struct A {
    struct Info {
        A* self;
    }

    auto getInfo() {
        return Info();
    }

    void a() {
        foo(false, getInfo);
    }
}
```

https://d.godbolt.org/z/jcGaj7PKq

--
Apr 10 2021