www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19464] New: typeof immutable fields order dependent

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 puremagic.com
          Reporter: dkorpel 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)

--
Dec 04 2018