Bug 1408 – Assertion failure: 'd' on line 4234 in file 'mtype.c' on faulty d code
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-08-09T16:33:00Z
Last change time
2014-02-16T15:22:53Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
sky
Comments
Comment #0 by sky — 2007-08-09T16:33:56Z
The compiler crashes when i try to compile the following faulty d code:
-------
struct ABC()
{
alias NonExistentTemplate!() y;
}
void main()
{
auto abc = new ABC!();
foreach (x; abc.y) {} // Required for the compiler to crash
}
-------
The output of the compiler is:
-------
ass4234.d(3): template instance identifier 'NonExistentTemplate' is not defined
ass4234.d(8): template instance ass4234.ABC!() error instantiating
Assertion failure: 'd' on line 4234 in file 'mtype.c'
abnormal program termination
-------
It does, however, not crash if you don't use a template in the template ABC or if you comment out the foreach loop. This bug is uncritical for development because the compiler actually shows all the errors before crashing...
Comment #1 by ddparnell — 2007-10-19T02:20:36Z
The following code also crashes with the same "Assertion failure" message.
----
struct X
{
import std.stdio;
}
void main()
{
X.std.stdio.writefln("");
}
----
However the following code compiles and runs ...
----
struct X
{
import std.stdio;
}
void main()
{
X.writefln("");
}
----
Comment #2 by lovesyao — 2008-03-13T16:20:47Z
Can we close this one?
It looks like a dupe of #1783 and that was closed by 1.026
Comment #3 by gide — 2008-12-03T12:54:09Z
(In reply to comment #1)
> The following code also crashes with the same "Assertion failure" message.
> ----
> struct X
> {
> import std.stdio;
> }
> void main()
> {
> X.std.stdio.writefln("");
> }
The error message now gives is slightly different to this title. Closing this bug and re-opened as BUG 2489.