https://issues.dlang.org/show_bug.cgi?id=22152
Issue ID: 22152
Summary: Block statement at beginning of statement not
recognized as function literal
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
```d
void main()
{ import std;
{writeln("hello world");}();
}
```
Compilation attempt result:
```
app.d(3): Error: expression expected, not `)`
app.d(3): Error: found `;` when expecting `)`
app.d(4): Error: found `}` when expecting `;` following statement
app.d(5): Error: found `End of File` when expecting `}` following compound
statement
```
The compiler should recognize the block statement as a function literal that is
immediately called.
Note that it will compile with this change:
```d
void main()
{ import std;
return {writeln("hello world");}();
}
```
--