Bug 11964 – Poor diagnostic in static assert with boolean operators

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-22T02:26:41Z
Last change time
2020-03-21T03:56:42Z
Keywords
diagnostic
Assigned to
No Owner
Creator
monarchdodra

Comments

Comment #0 by monarchdodra — 2014-01-22T02:26:41Z
//---- void main() { enum a = 0; enum b = 1; enum c = 2; static assert(b < a && a < b && b < c); } //---- This creates: //---- Error: static assert (false && 1 < 2) is false //---- This is not helpful at all.
Comment #1 by bearophile_hugs — 2014-01-22T02:48:29Z
Related to Issue 5004 ?
Comment #2 by monarchdodra — 2014-01-22T03:13:42Z
I think they are both ER on a same feature, yes, but the "root issue" seems completely different. 5004 is about aliases. This is about which value you actually show when the assert is triggered.
Comment #3 by b2.temp — 2020-02-20T15:34:13Z
The original expression is maintained now Error: static assert: `1 < 0 && (a < b) && (b < c)` is false