digitalmars.D.bugs - DMD 0.106 is severely broken
- Stewart Gordon (87/87) Nov 15 2004 It was drawn to my attention that SDWF refuses to compile under DMD
- Thomas Kuehne (9/19) Nov 15 2004 I've added your tests to DStress.
- Andy Friesen (6/16) Nov 15 2004 Forgive my forwardness, but why should they? :)
- Stewart Gordon (8/11) Nov 15 2004 Indeed, in the code snippet I posted it's useless. But in this
- Walter (5/87) Nov 15 2004 Anonymous structs at module scope should be diagnosed as an error.
- Thomas Kuehne (6/44) Nov 15 2004 http://digitalmars.com/d/attribute.html :
-
Stewart Gordon
(10/17)
Nov 16 2004
- Walter (4/20) Nov 16 2004 Yes.
It was drawn to my attention that SDWF refuses to compile under DMD 0.106. Though there was one thing genuinely wrong with my code, fixing this thing revealed even more things wrong with the compiler. 1. Anonymous structs/unions refuse to work, whether in a class or in module scope. ---------- import std.stdio; struct { int qwert; } void main() { writef(qwert); } ---------- D:\My Documents\Programming\D\Tests\bugs\broken106_struct.d(8): undefined identifier qwert ---------- 2. Moreover, if a class has an anonymous struct/union, any attempt to initialise any of the members causes trouble: ---------- class Qwert { struct { int yuiop = 13; } int asdfg = 42; } ---------- D:\My Documents\Programming\D\Tests\bugs\broken106_init.d(1): class broken106_init.Qwert 2duplicate union initialization for asdfg D:\My Documents\Programming\D\Tests\bugs\broken106_init.d(1): class broken106_init.Qwert 2duplicate union initialization for yuiop ---------- 3. Private members of nested classes are not accessible, either from the containing class, other classes in the module or other global functions in the module. ---------- class Qwert { this() { Yuiop asdfg = new Yuiop; asdfg.hjkl(); asdfg.zxcvb = 69; } class Yuiop { private { this() {} void hjkl() {} int zxcvb; } } } void main() { Qwert.Yuiop asdfg = new Qwert.Yuiop; asdfg.hjkl(); asdfg.zxcvb = 105; } class Nm { this() { Qwert.Yuiop asdfg = new Qwert.Yuiop; asdfg.hjkl(); asdfg.zxcvb = 666; } } ---------- D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(3): class broken106_private.Qwert.Yuiop member this is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(4): class broken106_private.Qwert.Yuiop member hjkl is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(5): class broken106_private.Qwert.Yuiop member zxcvb is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(18): class broken106_private.Qwert.Yuiop member this is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(19): class broken106_private.Qwert.Yuiop member hjkl is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(20): class broken106_private.Qwert.Yuiop member zxcvb is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(25): class broken106_private.Qwert.Yuiop member this is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(26): class broken106_private.Qwert.Yuiop member hjkl is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(27): class broken106_private.Qwert.Yuiop member zxcvb is not accessible ---------- I invite you all to post any other bugs that have newly appeared in 0.106 as followups to this thread, to keep them all together. Especially those that (like these) have prevented existing projects from compiling or running correctly. Stewart.
Nov 15 2004
I've added your tests to DStress. Thomas Stewart Gordon schrieb am 2004-11-15:It was drawn to my attention that SDWF refuses to compile under DMD 0.106. Though there was one thing genuinely wrong with my code, fixing this thing revealed even more things wrong with the compiler. 1. Anonymous structs/unions refuse to work, whether in a class or in module scope.http://svn.kuehne.cn/dstress/run/struct_17.d http://svn.kuehne.cn/dstress/run/union_11.d2. Moreover, if a class has an anonymous struct/union, any attempt to initialise any of the members causes trouble:http://svn.kuehne.cn/dstress/compile/struct_18.d http://svn.kuehne.cn/dstress/compile/union_10.d3. Private members of nested classes are not accessible, either from the containing class, other classes in the module or other global functions in the module.http://svn.kuehne.cn/dstress/run/private_02.d http://svn.kuehne.cn/dstress/run/private_03.d
Nov 15 2004
Stewart Gordon wrote:It was drawn to my attention that SDWF refuses to compile under DMD 0.106. Though there was one thing genuinely wrong with my code, fixing this thing revealed even more things wrong with the compiler. 1. Anonymous structs/unions refuse to work, whether in a class or in module scope. 2. Moreover, if a class has an anonymous struct/union, any attempt to initialise any of the members causes trouble:Forgive my forwardness, but why should they? :) Anonymous structs don't make a whole lot of sense in either of these cases. The only place I can think where they have any use at all is in unions. -- andy
Nov 15 2004
Andy Friesen wrote: <snip>Anonymous structs don't make a whole lot of sense in either of these cases. The only place I can think where they have any use at all is in unions.Indeed, in the code snippet I posted it's useless. But in this instance, it should either work or complain about a syntax error, not an undefined identifier. As for how I'm using it, SDWF has several instances of an anonymous struct within an anonymous union within a class. Stewart.
Nov 15 2004
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message news:cn9vah$1shn$1 digitaldaemon.com...It was drawn to my attention that SDWF refuses to compile under DMD 0.106. Though there was one thing genuinely wrong with my code, fixing this thing revealed even more things wrong with the compiler. 1. Anonymous structs/unions refuse to work, whether in a class or in module scope. ---------- import std.stdio; struct { int qwert; } void main() { writef(qwert); } ---------- D:\My Documents\Programming\D\Tests\bugs\broken106_struct.d(8): undefined identifier qwert ----------Anonymous structs at module scope should be diagnosed as an error.2. Moreover, if a class has an anonymous struct/union, any attempt to initialise any of the members causes trouble: ---------- class Qwert { struct { int yuiop = 13; } int asdfg = 42; } ---------- D:\My Documents\Programming\D\Tests\bugs\broken106_init.d(1): class broken106_init.Qwert 2duplicate union initialization for asdfg D:\My Documents\Programming\D\Tests\bugs\broken106_init.d(1): class broken106_init.Qwert 2duplicate union initialization for yuiop ----------This is a bug.3. Private members of nested classes are not accessible, either from the containing class, other classes in the module or other global functions in the module. ---------- class Qwert { this() { Yuiop asdfg = new Yuiop; asdfg.hjkl(); asdfg.zxcvb = 69; } class Yuiop { private { this() {} void hjkl() {} int zxcvb; } } } void main() { Qwert.Yuiop asdfg = new Qwert.Yuiop; asdfg.hjkl(); asdfg.zxcvb = 105; } class Nm { this() { Qwert.Yuiop asdfg = new Qwert.Yuiop; asdfg.hjkl(); asdfg.zxcvb = 666; } } ---------- D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(3): class broken106_private.Qwert.Yuiop member this is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(4): class broken106_private.Qwert.Yuiop member hjkl is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(5): class broken106_private.Qwert.Yuiop member zxcvb is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(18): class broken106_private.Qwert.Yuiop member this is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(19): class broken106_private.Qwert.Yuiop member hjkl is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(20): class broken106_private.Qwert.Yuiop member zxcvb is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(25): class broken106_private.Qwert.Yuiop member this is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(26): class broken106_private.Qwert.Yuiop member hjkl is not accessible D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(27): class broken106_private.Qwert.Yuiop member zxcvb is not accessible ----------I think they should not be accessible.
Nov 15 2004
Walter schrieb am Montag, 15. November 2004 19:26:[snip]3. Private members of nested classes are not accessible, either from the containing class, other classes in the module or other global functions in the module. ---------- class Qwert { this() { Yuiop asdfg = new Yuiop; asdfg.hjkl(); asdfg.zxcvb = 69; } class Yuiop { private { this() {} void hjkl() {} int zxcvb; } } } void main() { Qwert.Yuiop asdfg = new Qwert.Yuiop; asdfg.hjkl(); asdfg.zxcvb = 105; } class Nm { this() { Qwert.Yuiop asdfg = new Qwert.Yuiop; asdfg.hjkl(); asdfg.zxcvb = 666; } } ---------- D:\My Documents\Programming\D\Tests\bugs\broken106_private.d(3): class broken106_private.Qwert.Yuiop member this is not accessibleI think they should not be accessible.http://digitalmars.com/d/attribute.html :
Nov 15 2004
Walter wrote:"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message news:cn9vah$1shn$1 digitaldaemon.com...<snip><snip> I guess you're right. So the bug here is that it defers choking until you try to use it? I gave this as a minimal testcase. But I'm doing it in class scope, where the error is the same. OK, so maybe anonymous structs at class scope aren't particularly useful either, but anonymous unions at class scope certainly are. Stewart.D:\My Documents\Programming\D\Tests\bugs\broken106_struct.d(8): undefined identifier qwert ----------Anonymous structs at module scope should be diagnosed as an error.
Nov 16 2004
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message news:cnclos$2nhe$1 digitaldaemon.com...Walter wrote:Yes."Stewart Gordon" <smjg_1998 yahoo.com> wrote in message news:cn9vah$1shn$1 digitaldaemon.com...<snip><snip> I guess you're right. So the bug here is that it defers choking until you try to use it?D:\My Documents\Programming\D\Tests\bugs\broken106_struct.d(8): undefined identifier qwert ----------Anonymous structs at module scope should be diagnosed as an error.I gave this as a minimal testcase. But I'm doing it in class scope, where the error is the same. OK, so maybe anonymous structs at class scope aren't particularly useful either, but anonymous unions at class scope certainly are.I agree. That needs to be fixed.
Nov 16 2004