D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5408 - Calling GC.malloc inside a unittest with a flag of 1 results in an access violation.
Summary: Calling GC.malloc inside a unittest with a flag of 1 results in an access vio...
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 blocker
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2011-01-03 22:46 UTC by Rob Jacques
Modified: 2012-02-10 21:47 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Rob Jacques 2011-01-03 22:46:08 UTC
In DMD 2.051 (and probably DMD 2.050 as well), calling GC.malloc with the 'has interior pointers' flag (i.e., 1) inside a unittest block causes an access violation error or a program crash.

This is a blocker for non-trivial use of the std.variant and std.json enhancements I'm working inside of unittests, including their own.

Test case:

import core.memory;
unittest {
    GC.malloc(16, 0); // Okay
    GC.malloc(16, 1); // object.Error: Access Violation
}
Comment 1 Andrej Mitrovic 2012-01-21 16:29:26 UTC
Can't reproduce in 2.057 with `dmd -unittest test.d && test.exe`
Comment 2 yebblies 2012-02-10 21:47:50 UTC
Can't reproduce with dmd 2.058 beta.  Please reopen if you can reproduce with a recent version of dmd.