[Issue 21687] New: Confusing error message for CTFE pointer in static initializer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 7 18:12:17 UTC 2021


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 at puremagic.com
          Reporter: snarwin+bugzilla at 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]`.

--


More information about the Digitalmars-d-bugs mailing list