Memory error when using a template in a class destructor
JC via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jan 20 09:59:38 PST 2015
The following code throws a
core.exception.InvalidMemoryOperationError@(0), anyone have an
idea of what is causing it?
---
import std.stdio;
class Test
{
this()
{
struct Start
{
string filename;
}
Message!(Start)(Start("one.txt"));
}
~this()
{
struct Stop
{
string filename;
}
Message!(Stop)(Stop("one.txt"));
}
}
unittest
{
auto t = new Test();
}
struct Message(T)
{
this(T message)
{
writeln(typeid(T));
writeln(message);
}
More information about the Digitalmars-d-learn
mailing list