www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23934] New: Literal integer multiplication overflow is

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

          Issue ID: 23934
           Summary: Literal integer multiplication overflow is allowed in
                    CTFE
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: eyal weka.io

This example program generates the following assertion failure:

  static assert(1000*1000*1000*1000 > 0); // Error: static assert:  `-727379968
 0` is false
It would detect bugs earlier if constant-folding/CTFE execution of multiplication disallowed overflow. --
May 24 2023