[Issue 1371] New: Compiler rejects valid delegate.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 25 02:01:52 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1371

           Summary: Compiler rejects valid delegate.
           Product: D
           Version: 1.019
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: aziz.kerim at gmail.com


// The compiler tries to parse this as a struct initializer.
auto foo = { while (doSomething()){} }; // Error: expression expected, not
'while'

There are several workarounds to this.

auto foo = { while (doSomething()){;} }; // Insert a semicolon somewhere.
auto foo = (){ while (doSomething()){} }; // Add a ParameterList.
auto foo = delegate void (){ while (doSomething()){} }; // A full delegate
expression.


-- 



More information about the Digitalmars-d-bugs mailing list