www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23983] New: Better error message when brace missing after

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 puremagic.com
          Reporter: ryuukk.dev 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

--
Jun 09 2023