Thread overview
[Issue 7848] New: pure doesn't work on unittest blocks
Apr 07, 2012
Jonathan M Davis
[Issue 7848] pure and nothrow ignored on unittest blocks
Jun 07, 2013
Kenji Hara
Jun 08, 2013
Walter Bright
April 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7848

           Summary: pure doesn't work on unittest blocks
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: jmdavisProg@gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-04-06 22:43:59 PDT ---
This code compiles when it shouldn't:

void main()
{
}

void func()
{
}

pure unittest
{
    func();
}

func is impure and should cause the compilation of the unittest block to fail. It fails if you mark it as @safe (since func is @system), but it doesn't fail for pure.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
            Version|unspecified                 |D2
            Summary|pure ignored on unittest    |pure and nothrow ignored on
                   |blocks                      |unittest blocks


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-06-06 21:04:05 PDT ---
Same bug exists for nothrow unittest

void func() {}
nothrow unittest { func(); }

Compiler fix: https://github.com/D-Programming-Language/dmd/pull/2142

-- 
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=7848



--- Comment #2 from github-bugzilla@puremagic.com 2013-06-07 21:07:56 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/da5c0cfbd5f8e66dd0bbc180c424f3d58686bd4c fix Issue 7848 - pure and nothrow ignored on unittest blocks

https://github.com/D-Programming-Language/dmd/commit/21c30ac9dea49cfc234e8f2268efe09a21b630c8 Merge pull request #2142 from 9rnsr/fix7848

Issue 7848 - pure and nothrow ignored on unittest blocks

-- 
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=7848


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


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