[Issue 14039] New: function is incorrectly inferred as 'pure'

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jan 24 15:15:10 PST 2015


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

          Issue ID: 14039
           Summary: function is incorrectly inferred as 'pure'
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

void fa() {}

 auto fb10148(T)()
 {
    struct A(S)
    {
        void fc(T2)()
        {
            fa();
        }
        this(S a) {}
    }

    return A!int.init;
 }

 void test10148()
 {
    fb10148!int.fc!int;
 }

when compiled:

 foo.d(9): Error: pure function 'foo.fb10148!int.fb10148.A!int.A.fc!int.fc'
cannot call impure function 'foo.fa'

But calling fa() should have made fc() into an impure function.

--


More information about the Digitalmars-d-bugs mailing list