[Issue 15627] New: @safe code generates access violation
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jan 29 21:47:20 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15627
Issue ID: 15627
Summary: @safe code generates access violation
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: matt.elkins at gmail.com
The following code will generate an access violation on DMD 2.070
[code]
@safe:
struct Foo(alias Callback)
{
~this() {Callback();}
}
unittest
{
uint stackVar;
void bar() {++stackVar;}
alias FooType = Foo!(bar);
FooType foo = FooType.init;
}
[/code]
[output]
object.Error@(0): Access Violation
----------------
0x00405F46 in @safe void test.__unittestL9_4().bar() at <path>\test.d(12)
0x00405F5D in @safe void test.Foo!(@safe void
test.__unittestL9_4().bar()).Foo.__dtor() at <path>\test.d(6)
0x00405F37 in @safe void test.__unittestL9_4() at <path>\test.d(14)
0x00405FB8 in void test.__modtest()
0x0040B635 in int
core.runtime.runModuleUnitTests().__foreachbody1(object.ModuleInfo*)
0x004153CF in int object.ModuleInfo.opApply(scope int
delegate(object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*))
Program exited with code 1
[/output]
Line 12 is the definition of bar().
Line 6 is the destructor of Foo.
Line 14 is the assignment of foo from FooType.init.
--
More information about the Digitalmars-d-bugs
mailing list