Thread overview
[Bug 128] New: DMD crash with static if and anonymous classes
May 05, 2006
d-bugmail
May 18, 2006
d-bugmail
May 18, 2006
d-bugmail
May 18, 2006
d-bugmail
May 19, 2006
d-bugmail
May 24, 2006
Thomas Kuehne
May 05, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=128

           Summary: DMD crash with static if and anonymous classes
           Product: D
           Version: 0.156
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: h3r3tic@mat.uni.torun.pl


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 ?


-- 

May 18, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=128


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com
           Keywords|                            |ice-on-valid-code




------- Comment #1 from smjg@iname.com  2006-05-18 09:37 -------
Compiler crashing is always a bug.


-- 

May 18, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=128





------- Comment #2 from h3r3tic@mat.uni.torun.pl  2006-05-18 13:37 -------
(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


-- 

May 18, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=128


unknown@simplemachines.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |unknown@simplemachines.org




------- Comment #3 from unknown@simplemachines.org  2006-05-18 15:42 -------
(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]


-- 

May 19, 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=128





------- Comment #4 from smjg@iname.com  2006-05-19 15:26 -------
Something went askew while updating the documentation.  Line breaks have also emerged in weird places.  Not to mention numerous spelling mistakes....


-- 

May 24, 2006
d-bugmail@puremagic.com schrieb am 2006-05-05:
> The following code causes DMD to crash without printing anything:
>
> class Foo {}
> static if (is(typeof(new class Foo{}))) {}

Added to DStress as http://dstress.kuehne.cn/compile/c/class_24_A.d http://dstress.kuehne.cn/compile/c/class_24_B.d

Thomas