resurrect empty statement (#15409)

This commit is contained in:
Walter Bright 2023-07-13 08:46:57 -07:00 committed by GitHub
parent 90f5bd1635
commit b6a970643d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 23 deletions

View file

@ -6034,7 +6034,7 @@ LagainStc:
auto statements = new AST.Statements();
while (token.value != TOK.rightCurly && token.value != TOK.endOfFile)
{
statements.push(parseStatement(ParseStatementFlags.curlyScope));
statements.push(parseStatement(ParseStatementFlags.curlyScope | ParseStatementFlags.semiOk));
}
if (endPtr)
*endPtr = token.ptr;

View file

@ -0,0 +1,19 @@
/*
REQUIRED_ARGS:
TEST_OUTPUT:
---
---
*/
void foo()
{
int x;;
enum A
{
a,
b,
c
};
void bar() {};
}

View file

@ -1,22 +0,0 @@
/*
REQUIRED_ARGS:
TEST_OUTPUT:
---
fail_compilation/fail4559.d(13): Error: use `{ }` for an empty statement, not `;`
fail_compilation/fail4559.d(19): Error: use `{ }` for an empty statement, not `;`
fail_compilation/fail4559.d(21): Error: use `{ }` for an empty statement, not `;`
---
*/
void foo()
{
int x;;
enum A
{
a,
b,
c
};
void bar() {};
}