www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22242] New: ICE when an overload is aliased back into a mixin

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

          Issue ID: 22242
           Summary: ICE when an overload is aliased back into a mixin
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

Compiling this causes a segfault:

mixin template Foo()
{
    alias foo = typeof(this).foo; // (1)

    void foo(int a)
    {
        ubyte b;
        foo(b);
    }
}

struct S
{
    void foo(ubyte a)
    {
    }

    mixin Foo f;
    alias foo = f.foo;
}

void main()
{
}


It is order-dependent: if (1) is placed after foo's definition, the code
compiles.

--
Aug 26 2021