What    |Removed                     |Added
            Summary|struct in delegate requires |Delegate literal as
                   |semicolon                   |initializer is confused with
                   |                            |struct initializer
            Version|unspecified                 |1.041

------- Comment #7 from  2009-04-19 07:29 -------
> 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


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.


Reply via email to