www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22308] New: [REG2.097] ICE regarding local symbol renaming

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

          Issue ID: 22308
           Summary: [REG2.097] ICE regarding local symbol renaming
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kinke gmx.net

This segfaults DMD v2.097.2 (and current DMD stable) but compiles fine with
v2.096.1 - sorry, not fully reduced:

```
import std.meta : AliasSeq;
import std.traits : OriginalType;

private alias AliasThisTypeOf(T) = typeof(__traits(getMember, T.init,
__traits(getAliasThis, T)[0]));

template BooleanTypeOf(T)
{
    static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT))
        alias X = BooleanTypeOf!AT;
    else
        alias X = OriginalType!T;

    static if (is(immutable X == immutable bool))
        alias BooleanTypeOf = X;
    else
        static assert(0, T.stringof~" is not boolean type");
}

alias SampleTypes = AliasSeq!(bool,
                              char, wchar, dchar,
                              byte, ubyte,
                              short, ushort,
                              int, uint,
                              long, ulong,
                              float, double, real,
                              string, wstring, dstring);

void main()
{
    enum count = 5_000;
    static foreach (i; 0 .. count)
        foreach (T; SampleTypes)
            enum _ = is(BooleanTypeOf!(T));
}
```

It hits an assertion with a debug build:
core.exception.AssertError src/dmd/expressionsem.d(5269): Assertion failure

=> https://github.com/dlang/dmd/blob/stable/src/dmd/expressionsem.d#L5269

Note the comment: '65535 should be enough for anyone' (just like the 640 kB
ought to be enough for anyone, right? ;))

--
Sep 14