[Issue 21163] New: Scope lambda argument in struct initializer causes parsing error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 15 16:16:15 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21163

          Issue ID: 21163
           Summary: Scope lambda argument in struct initializer causes
                    parsing error
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: snarwin+bugzilla at gmail.com

The following program fails to compile with dmd 2.093.0:

---
struct S
{
    void function(scope int) fp;
}

S s = {
    fp: (scope int x) {}
};
---

The compiler's output:

$ dmd -c bug.d 
bug.d(8): Error: found `}` when expecting `;` following statement
bug.d(8): Deprecation: use `{ }` for an empty statement, not `;`
bug.d(9): Error: found `End of File` when expecting `}` following compound
statement
bug.d(9): Error: semicolon expected, not `End of File`

--


More information about the Digitalmars-d-bugs mailing list