[Issue 24421] New: expression `&B(A(1)).a` is not a constant

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 28 15:43:50 UTC 2024


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

          Issue ID: 24421
           Summary: expression `&B(A(1)).a` is not a constant
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ellapaul392 at gmail.com

```d
struct A {
        int i;
}

struct B {
        A a;
}

__gshared const B b = {a:{1}};
__gshared const A* aptr = &b.a;

```

Error: expression `&B(A(1)).a` is not a constant


aptr is a const, and can be resolved at compile time.

--


More information about the Digitalmars-d-bugs mailing list