[Issue 16500] New: inferred != annotated pure

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Sep 16 06:29:46 PDT 2016


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 at puremagic.com
          Reporter: qs.il.paperinik at 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

--


More information about the Digitalmars-d-bugs mailing list