www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21610] New: CTFE should not evaluate both branches for ?:

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

          Issue ID: 21610
           Summary: CTFE should not evaluate both branches for ?: operator
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla bernis-buecher.de

enum a = false ? 1 / 0 : 1;

does not compile, but produces

/home/D/test.d(1): Error: divide by 0

--
Feb 04 2021