www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22529] New: wrong deprecation about empty statement

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 puremagic.com
          Reporter: b2.temp 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 --
Nov 20 2021