Bug 228 – Crash on inferring function literal return type after prior errors

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-06-27T11:40:00Z
Last change time
2014-02-15T13:19:18Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla

Comments

Comment #0 by matti.niemenmaa+dbugzilla — 2006-06-27T11:40:33Z
Either of the following pieces of code causes a crash - no internal error message, a downright "dmd.exe has encountered a problem". (I'm tagging this as "ice-on-invalid-code" even though there's no ICE, just a crash.) -- void main() { x = function(){}; } -- void main() { y = 2; auto x = function(){}; } -- The above examples can, of course, be extended: using any undefined identifier at some point in the code and then, below that, trying to have a function literal's return type inferred seems to cause this crash. The error regarding the identifier is correctly reported prior to the crash, so the problem can be found and fixed easily, and hence this isn't that bad even though the compiler does crash.
Comment #1 by matti.niemenmaa+dbugzilla — 2006-11-19T05:48:23Z
This annoyance takes place with some other errors as well: -- void main() { bool b = 2; // cannot implicitly convert expression (2) of type int to bool auto x = function(){}; // ... and a DMD crash } -- deprecated int a; void main() { a = 2; // variable asdf.a is deprecated auto x = function(){}; // ... and a DMD crash } -- void main() { const int a = [2]; // cannot use array to initialize auto x = function(){}; // ... and a DMD crash } -- const int a; // variable asdf.a missing initializer in static constructor for const variable static this() { } void main() { auto x = function(){}; // ... and a DMD crash } -- void f(int i) {} void main() { f(); // expected 1 arguments, not 0 auto x = function(){}; // ... and a DMD crash } -- I'm sure I could find more examples if I felt like it. Still, all errors don't trigger it: -- void main() { int x; auto x = function(){}; // asdf.main.x is already defined } -- void main() { import auto x = function(){}; // found 'import' instead of statement } -- This one was interesting, it triggers only if it's at function scope: -- void main() { void x = function(){}; // variable asdf.main.x voids have no value, DMD crash } -- void x = function(){}; // variable asdf.x voids have no value, DMD doesn't crash --
Comment #2 by bugzilla — 2006-11-25T03:26:19Z
Fixed DMD 0.175