[Issue 22529] New: wrong deprecation about empty statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 20 09:38:31 UTC 2021


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

          Issue ID: 22529
           Summary: wrong deprecation about empty statement
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

Code:
====

---
void main() {
  f()
  return;
}  
---

Output:
======

> /tmp/temp_7FCF86B2C530.d:4:3: Error: found `return` when expecting `;` following statement
> /tmp/temp_7FCF86B2C530.d:4:9: Deprecation: use `{ }` for an empty statement, not `;`


Problem:
=======

The error message is right, the deprecation message is wrong. There is zero
empty statement in the code.
There is just one errored ExpStatement.

Run.dlang.io:
============

>Up to      2.074.1: Failure with output: onlineapp.d(3): Error: found 'return' > when expecting ';' following statement
>           2.075.1: Failure with output:
>-----
>onlineapp.d(3): Error: found 'return' when expecting ';' following statement
>onlineapp.d(3): Deprecation: use '{ }' for an empty statement, not a ';'
>-----
>Since      2.076.1: Failure with output:
>-----
>onlineapp.d(3): Error: found `return` when expecting `;` following statement
>onlineapp.d(3): Deprecation: use `{ }` for an empty statement, not `;`
>-----

the diagnostic was correct until 2.074.1

--


More information about the Digitalmars-d-bugs mailing list