www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22226] New: [REG 2.095.1] __ctfe + function call in

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

          Issue ID: 22226
           Summary: [REG 2.095.1] __ctfe + function call in conditional
                    expression used to initialize struct member in
                    constructor causes ICE
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of DMD 2.097.2, attempting to compile the following program causes DMD to
crash due to a segmentation fault:

---
struct A {}

A move(A a) { return A.init; }

struct SumType
{
    A a;

    this(A value)
    {
        a = __ctfe ? value : move(value);
    }
}
---

According to run.dlang.io, this is a regression introduced in DMD 2.095.1:

---
Up to      2.094.1: Success and no output
Since      2.095.1: Segfault and no output
---

Attempting to compile the above program using a build of DMD with assertions
enabled results in the following error message:

---
dmd: src/dmd/backend/cod3.d:1391: Assertion `t' failed.
---

--
Aug 19