www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 128] New: DMD crash with static if and anonymous classes

reply d-bugmail puremagic.com writes:
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 05 2006
next sibling parent d-bugmail puremagic.com writes:
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





Compiler crashing is always a bug.


-- 
May 18 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=128







 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
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=128


unknown simplemachines.org changed:

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






 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 18 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=128






Something went askew while updating the documentation.  Line breaks have also
emerged in weird places.  Not to mention numerous spelling mistakes....


-- 
May 19 2006
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- iD8DBQFEdE6u3w+/yD4P9tIRAmkOAJ0Z0XpVF93SykaDIQcir0o/Fns2yQCfXtlC NtgsC3NMSO48P6EOmrf+4ww= =2g10 -----END PGP SIGNATURE-----
May 24 2006