mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 05:30:13 +03:00
resurrect empty statement (#15409)
This commit is contained in:
parent
90f5bd1635
commit
b6a970643d
3 changed files with 20 additions and 23 deletions
|
@ -6034,7 +6034,7 @@ LagainStc:
|
||||||
auto statements = new AST.Statements();
|
auto statements = new AST.Statements();
|
||||||
while (token.value != TOK.rightCurly && token.value != TOK.endOfFile)
|
while (token.value != TOK.rightCurly && token.value != TOK.endOfFile)
|
||||||
{
|
{
|
||||||
statements.push(parseStatement(ParseStatementFlags.curlyScope));
|
statements.push(parseStatement(ParseStatementFlags.curlyScope | ParseStatementFlags.semiOk));
|
||||||
}
|
}
|
||||||
if (endPtr)
|
if (endPtr)
|
||||||
*endPtr = token.ptr;
|
*endPtr = token.ptr;
|
||||||
|
|
19
compiler/test/compilable/emptystatement.d
Normal file
19
compiler/test/compilable/emptystatement.d
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
REQUIRED_ARGS:
|
||||||
|
TEST_OUTPUT:
|
||||||
|
---
|
||||||
|
---
|
||||||
|
*/
|
||||||
|
|
||||||
|
void foo()
|
||||||
|
{
|
||||||
|
int x;;
|
||||||
|
enum A
|
||||||
|
{
|
||||||
|
a,
|
||||||
|
b,
|
||||||
|
c
|
||||||
|
};
|
||||||
|
|
||||||
|
void bar() {};
|
||||||
|
}
|
|
@ -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() {};
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue