http://d.puremagic.com/issues/show_bug.cgi?id=10296

           Summary: Nested template function call and purity inference bug
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: k.hara...@gmail.com


--- Comment #0 from Kenji Hara <k.hara...@gmail.com> 2013-06-07 22:10:19 PDT ---
This is similar to bug 10288.

Nested function 'bar' accesses to outer scope variable 'a', so it's inferred as
impure. But, 'bar' does not access to variables out of 'foo', so the outer
function 'foo' should be still inferred as pure so calling 'bar' does not break
its purity.

pure void main()
{
    foo();
}
void foo()()
{
    int[3] a;
    void bar()() { a[1] = 2; }

    bar();
    pragma(msg, typeof(bar!()));    // nothrow @safe void()
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to