www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16500] New: inferred != annotated pure

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

          Issue ID: 16500
           Summary: inferred != annotated pure
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: qs.il.paperinik gmail.com

struct X(T)
    {
        this(S)(in S[] arr) // inferred pure
        { }
    }

    void main() pure
    {
        X!uint mut = [ 1, 2 ]; // proves inference (cf. main is pure)
        // immutable X!uint imm1 = [ 1, 2 ];
        // auto imm2 = immutable X!uint([1, 2]);
    }

The last lines don't compile. However, they do if the inferred pure is
explicitly annotated.

From the discussion
https://forum.dlang.org/post/seuujamznrzqygrrpyfi forum.dlang.org --
Sep 16 2016