www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19225] New: Confusing error message on `static else`

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

          Issue ID: 19225
           Summary: Confusing error message on `static else`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: desisma heidel.beer

Of course, it's just `else` and there's no `static else`, but the compiler
won't really help one in case one assumed `static else` is fine.


Motivation:
This happened to someone on a Dlang-related Discord server today.
Well, to be honest, it happened to me when I used `static if` for the first
time, too.


Current state:
rdmd --compiler=dmd --eval="static if(false){}static else {}"
/tmp/.rdmd-1000/eval.FE84D13526EC0E678549134C9377EB0E.d(18): Error: basic type
expected, not else


Solution:
Let the compiler hint at the fact it's just `else`.

--
Sep 05 2018