[Issue 10296] New: Nested template function call and purity inference bug

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 7 22:10:20 PDT 2013


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: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at 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: -------


More information about the Digitalmars-d-bugs mailing list