Bug 128 – DMD crash with static if and anonymous classes

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-05-05T15:14:00Z
Last change time
2014-02-15T13:22:07Z
Keywords
ice-on-valid-code
Assigned to
bugzilla
Creator
h3r3tic

Comments

Comment #0 by h3r3tic — 2006-05-05T15:14:54Z
The following code causes DMD to crash without printing anything: class Foo {} static if (is(typeof(new class Foo{}))) {} Also, if I'm reading it correctly, the spec says that creating an instance of an anonymous class derived from Foo should look like "new class : Foo {}", while DMD prefers the "new class Foo {}" syntax. Is that a compiler or documentation bug ?
Comment #1 by smjg — 2006-05-18T09:37:11Z
Compiler crashing is always a bug.
Comment #2 by h3r3tic — 2006-05-18T13:37:52Z
(In reply to comment #1) > Compiler crashing is always a bug. Sure.. but my question wasn't about the crash. I asked "Is that a compiler or documentation bug ?" about the documentation/compiler mismatch. At the time of my original posting the doc said that a definition of an anonymous class contains BaseClassList_opt, which is defined to include the ':' token. In other words, the doc said DMD accepts: new class Foo : Bar{} while it wants: new class Foo Bar {} The documentation has been changed now, but it sill contains a minor bug: new ()ArgumentListopt class ()ArgumentListopt SuperClassopt InterfaceClassesopt ClassBody IMHO should be: new (ArgumentListopt) class (ArgumentListopt) SuperClassopt InterfaceClassesopt ClassBody /Tom
Comment #3 by bugs-d — 2006-05-18T15:42:33Z
(In reply to comment #2) > The documentation has been changed now, but it sill contains a minor bug: > > new ()ArgumentListopt class ()ArgumentListopt SuperClassopt InterfaceClassesopt > ClassBody > > IMHO should be: > > new (ArgumentListopt) class (ArgumentListopt) SuperClassopt InterfaceClassesopt > ClassBody > Actually, that's done throughout the documentation. I think it a bit strange, but it makes an amount of sense too. If that should be changed, it would have to be changed _everywhere_. And since I seem to remember it being the way you suggest, I can only guess it was changed on purpose. Anyway, I bet using the : makes parsing ternaries fun, which is probably why it doesn't use it. -[Unknown]
Comment #4 by smjg — 2006-05-19T15:26:45Z
Something went askew while updating the documentation. Line breaks have also emerged in weird places. Not to mention numerous spelling mistakes....
Comment #5 by bugzilla — 2006-06-20T02:20:41Z
Fixed DMD 0.161
Comment #6 by thomas-dloop — 2007-01-01T04:28:25Z