[Issue 19225] New: Confusing error message on `static else`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 5 17:16:38 UTC 2018


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 at puremagic.com
          Reporter: desisma at 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`.

--


More information about the Digitalmars-d-bugs mailing list