Bug 23159 – [betterC] scope(failure) use in betterC gives confusing error
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-06-05T04:09:43Z
Last change time
2022-06-08T11:16:35Z
Keywords
betterC, pull
Assigned to
No Owner
Creator
Jack Stouffer
Comments
Comment #0 by jack — 2022-06-05T04:09:43Z
```
void main()
{
scope(failure)
{
int a;
}
int b;
}
```
Gives
```
$ dmd -betterC main.d
Error: Cannot use try-catch statements with -betterC
```
Two problems here. One, there's no line number. Two, this does not give any indication to the user about the true cause of this error. Thankfully I knew what to look for because I knew that scope(failure) was lowered to a try catch from a dconf talk.
Really, scope(success)/scope(failure) has no business being in betterC code and should get its own custom error message.
Comment #1 by dlang-bot — 2022-06-06T12:12:01Z
@RazvanN7 created dlang/dmd pull request #14184 "Fix Issue 23159 - [betterC] scope(failure) use in betterC gives confu…" fixing this issue:
- Fix Issue 23159 - [betterC] scope(failure) use in betterC gives confusing error
https://github.com/dlang/dmd/pull/14184
Comment #2 by dlang-bot — 2022-06-08T11:16:35Z
dlang/dmd pull request #14184 "Fix Issue 23159 - [betterC] scope(failure) use in betterC gives confu…" was merged into master:
- 6905c3ce783419dd9711a56dd830ce9da37d6959 by RazvanN7:
Fix Issue 23159 - [betterC] scope(failure) use in betterC gives confusing error
https://github.com/dlang/dmd/pull/14184