Bug 19225 – Confusing error message on `static else`
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-09-05T17:16:38Z
Last change time
2018-09-07T13:11:15Z
Assigned to
No Owner
Creator
Elias Batek (0xEAB)
Comments
Comment #0 by desisma — 2018-09-05T17:16:38Z
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`.