Bug 20683 – errors in static assert do not halt compilation immediately

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-03-17T19:47:32Z
Last change time
2023-04-17T15:47:21Z
Keywords
diagnostic
Assigned to
No Owner
Creator
elpenguino+D

Comments

Comment #0 by elpenguino+D — 2020-03-17T19:47:32Z
``` static assert(somethingBogus); static assert(false); ``` Normally, when a static assert's expression evaluates to false, compilation is halted immediately. However, this doesn't happen when there is an error in the expression. In this situation, I would expect the appropriate error for the statement to be issued and for compilation to halt before the second static assert is evaluated.
Comment #1 by razvan.nitu1305 — 2023-04-17T15:47:21Z
Having an error in the static assert expression does not mean that the expression is false (or true). It means that a mistake has been made that needs to be reported. The compiler is right to report the error and continue compilation.