[Issue 23159] New: [betterC] scope(failure) use in betterC gives confusing error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 5 04:09:43 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23159
Issue ID: 23159
Summary: [betterC] scope(failure) use in betterC gives
confusing error
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: jack at jackstouffer.com
```
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.
--
More information about the Digitalmars-d-bugs
mailing list