Bug 7848 – pure and nothrow ignored on unittest blocks

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-06T22:43:00Z
Last change time
2013-06-07T21:08:07Z
Keywords
accepts-invalid, pull
Assigned to
nobody
Creator
issues.dlang

Comments

Comment #0 by issues.dlang — 2012-04-06T22:43:59Z
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.
Comment #1 by k.hara.pg — 2013-06-06T21:04:05Z
Same bug exists for nothrow unittest void func() {} nothrow unittest { func(); } Compiler fix: https://github.com/D-Programming-Language/dmd/pull/2142
Comment #2 by github-bugzilla — 2013-06-07T21:07:56Z
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