Thread overview
[Issue 10296] New: Nested template function call and purity inference bug
Jun 08, 2013
Kenji Hara
Jun 08, 2013
Kenji Hara
Jun 10, 2013
Kenji Hara
June 08, 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@puremagic.com
        ReportedBy: k.hara.pg@gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg@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: -------
June 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10296


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-06-07 22:15:45 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2149

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10296



--- Comment #2 from github-bugzilla@puremagic.com 2013-06-09 23:16:54 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/acbaadd13c69b82d3485bb3bbc8ab7a3041f2548 fix Issue 10296 - Nested template function call and purity inference bug

https://github.com/D-Programming-Language/dmd/commit/f38a573472bf576fdf9319eacdc75e4b5c345d7c Merge pull request #2149 from 9rnsr/fix10296

Issue 10296 - Nested template function call and purity inference bug

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10296


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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