The following one-liner causes an ICE in line 0. Verified on GDC .21, .23 and DMD 1.007: void main() { void delegate() test={ struct test2 {;} }; } Greetings, downs
Added to DStress as http://dstress.kuehne.cn/nocompile/s/struct_29_A.d http://dstress.kuehne.cn/run/s/struct_29_B.d
Fixed DMD 1.009
Seems 1.022 doesn't compile this, and 1.009 compiles this?
(In reply to comment #3) > Seems 1.022 doesn't compile this, and 1.009 compiles this? > Strange. Builds fine on my gdc .24/1.022 under linux/32-bit.
it's http://dstress.kuehne.cn/run/s/struct_29_B.d which can't pass the parse stage. seems dmd need a semicolon in the struct in the delegate.
This is really a totally different bug to the original one, and much less severe. No longer an ICE -- it's a pretty tiny issue. void main() { void delegate() test = { struct test2{} } } --- fog.d(4): expression expected, not 'struct' fog.d(4): comma expected separating field initializers fog.d(5): semicolon expected, not '}' ----
> fog.d(5): semicolon expected, not '}' This last message is the one that's correct. A declaration of a variable (which is what test is) always requires a closing semicolon. What's actually happening is that it's trying to parse { struct test2{} } as a struct initializer. Nothing to do with the struct that's actually declared inside. See for yourself: ---------- C:\Users\Stewart\Documents\Programming\D\Tests\bugs>type bz1030a.d void main() { void delegate() test = { struct test2{} }; } C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd bz1030a.d bz1030a.d(4): expression expected, not 'struct' bz1030a.d(4): comma expected separating field initializers C:\Users\Stewart\Documents\Programming\D\Tests\bugs>type bz1030b.d void main() { void delegate() test; test = { struct test2{} }; } C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd bz1030b.d C:\Users\Stewart\Documents\Programming\D\Tests\bugs> ---------- Since AIUI there's no overlap between what's parseable as a struct init and what's parseable as a delegate literal, there should be little or no problem getting it to work.
This remaining bug is not a regression. It behaved exactly the same way in DMD0.175. Another of these annoying cases where we have two unrelated bugs in the same report. It should not have been reopened.
The original bug was fixed in 1.009. The bug reported in the comments is the same as bug 1371; I'm therefore closing this one.