www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21687] New: Confusing error message for CTFE pointer in

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

          Issue ID: 21687
           Summary: Confusing error message for CTFE pointer in static
                    initializer
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

Example program:

---
auto p = new int;
---

With DMD 2.095.0, attempting to compile the above program produces the
following error message:

---
Error: cannot use non-constant CTFE pointer in an initializer `&[0][0]`
---

The initializer expression appears in the source code as `new int`, but is
printed as `&[0][0]`.

--
Mar 07 2021