www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22227] New: `if (scope f = x())` and `while (scope f = x())`

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

          Issue ID: 22227
           Summary: `if (scope f = x())` and `while (scope f = x())` do
                    not parse
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

```
void main ()
{
        if (scope foo = bar())
            assert(0);
}
int* bar () { return null; }
```

```
void main ()
{
        while (scope foo = bar())
            assert(0);
}
int* bar () { return null; }
```

Those two snippets should compile.

--
Aug 20 2021