www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14324] New: Cannot cast AA to immutable at compile time

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

          Issue ID: 14324
           Summary: Cannot cast AA to immutable at compile time
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: dransic gmail.com

immutable(int)[string] foo(int[string] aa) {
    return cast(immutable(int)[string]) aa;
}

void main() {
    auto x = foo(["a": 1]);
    enum y = foo(["a": 1]); // Error
}

bug.d(2): Error: cannot cast ["a":1] to immutable(int)[string] at compile time



--
Mar 24 2015