[Issue 19464] New: typeof immutable fields order dependent

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 4 13:56:21 UTC 2018


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

          Issue ID: 19464
           Summary: typeof immutable fields order dependent
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dkorpel at live.nl

When declaring an immutable field using typeof() on another immutable field,
the field in typeof() has to be declared above or the new one won't be
immutable.

Code:
```
typeof(a0)    b0 = 3;
immutable int a0 = 4;
pragma(msg, typeof(b0));

immutable int a1 = 4;
typeof(a1)    b1 = 3;
pragma(msg, typeof(b1));
```

Expected:
immutable(int)
immutable(int)

Actual:
int
immutable(int)

--


More information about the Digitalmars-d-bugs mailing list