www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14039] New: function is incorrectly inferred as 'pure'

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

--
Jan 24 2015