[Issue 23983] New: Better error message when brace missing after `else`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 9 23:51:20 UTC 2023


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

          Issue ID: 23983
           Summary: Better error message when brace missing after `else`
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ryuukk.dev at gmail.com

The following code: 

```
void main()
{
    int stuff = 0;
    version (Poxis)
    {
        stuff++;
    }
    else
        stuff++;
    } 
}
```

gives:

```
onlineapp.d(14): Error: unmatched closing brace
```

The problem with that error message is the scope is not respected, so if you
have bunch of code aafter that missing `{`, then it'll be VERY difficult to
guess where the problem exactly is


Solution:

DMD should tell me where the problem is right away, at the right scope

--


More information about the Digitalmars-d-bugs mailing list