D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13464 - dmd: aliasthis.c:96: virtual void AliasThis::semantic(Scope*): Assertion `ad2->type == Type::terror' failed.
Summary: dmd: aliasthis.c:96: virtual void AliasThis::semantic(Scope*): Assertion `ad2...
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-13 05:11 UTC by deadalnix
Modified: 2018-11-02 10:42 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description deadalnix 2014-09-13 05:11:44 UTC
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 ?
Comment 1 RazvanN 2018-11-02 10:42:43 UTC
Running the code does not yield an ICE anymore on git HEAD. The compilation results in correctly reported error messages. Closing as WORKSFORME.