www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13464] New: dmd: aliasthis.c:96: virtual void

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

          Issue ID: 13464
           Summary: dmd: aliasthis.c:96: virtual void
                    AliasThis::semantic(Scope*): Assertion `ad2->type ==
                    Type::terror' failed.
           Product: D
           Version: unspecified
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: deadalnix gmail.com

m1.d:
import m2;

struct S {
    void visit() {
        D!({});
    }
}

m2.d:
class A {
}

class B {
    A[] as;
}

import std.algorithm;
struct C(alias handler) {
    void visit() {
        E!handler.visit();
    }

    void visit() {
        E!handler.visit();
    }
}

struct D(alias handler) {

    void resolve(B b) {
        b.as.map!((a) {
            C!h.visit();
        });
    }
}

void h()() {
}

struct E(alias handler) {
    A a;
    alias a this;

    alias Ret = typeof(null);

    Ret visit() {
    }
}

$ dmd -c m1.d
[...]
dmd: aliasthis.c:96: virtual void AliasThis::semantic(Scope*): Assertion
`ad2->type == Type::terror' failed.
Abandon

I haven't been able to come up with a reasonably small piece of code that
trigger the assert fail without containing other errors. And may be the much
larger code also contains errors, but the assert kicks in before these errors
are visible ?

Also, since when dmd has become passive aggressive ? Failing because something
is not an error ? Has type checking become so scary that we have type terror ?

--
Sep 12 2014