www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22662] New: ICE caused by forward reference


          Issue ID: 22662
           Summary: ICE caused by forward reference
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

As of DMD 2.098.1, the following program fails to compile:

enum isHashable(T) = __traits(compiles, T.init.tupleof[0][0].sizeof);

struct SumType(Types...)
    union Storage
        Types values;

    Storage storage;

    static if (isHashable!(Types[0])) {}

string[] toLines(Expression val) {
    return [];

alias Expression = SumType!(Scope, Return);

struct Return {
    Expression* _expr = new Expression;

struct Scope {
    Expression[] statements;

    string[] toLines() {
        return Expression.init.toLines;

When attempting to compile, DMD gives the following output:

Error: unknown, please file report on issues.dlang.org

Any further reduction of the example program either causes compilation to
succeed, or results in a different error.

Jan 09 2022