www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10694] New: wrong purity check for static variables with impure destructor

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10694

           Summary: wrong purity check for static variables with impure
                    destructor
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com


--- Comment #0 from monarchdodra gmail.com 2013-07-22 02:32:44 PDT ---
//----
import std.stdio;

struct Foo
{
    ~this()
    {
        writeln("destroyed");
    }
}

void bar() pure
{
    static Foo i; //(13)
}

void main()
{
    bar();
}
//----
main.d(13): Error: pure function 'main.bar' cannot access mutable static data
'i'
main.d(13): Error: pure function 'main.bar' cannot call impure function
'main.Foo.~this'
//----

Because i is static, its destructor should never be called, so bar should not
be concerned that i's destructor is not pure.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 22 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10694


Henning Pohl <henning still-hidden.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |henning still-hidden.de


--- Comment #1 from Henning Pohl <henning still-hidden.de> 2013-07-22 14:59:13
PDT ---
https://github.com/D-Programming-Language/dmd/pull/2373

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 22 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10694



--- Comment #2 from github-bugzilla puremagic.com 2013-07-24 20:35:46 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/33dda1f177478c34113b47dcd24cd54c08100cb4
fix issue 10694 - wrong purity check for static variables with impure
destructor

https://github.com/D-Programming-Language/dmd/commit/2b1bc0eea17bd2f7497f73285d3411079844c704
Merge pull request #2373 from hpohl/10694

fix issue 10694 - wrong purity check for static variables with impure
destructor

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 24 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10694


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: -------
Jul 24 2013