[Issue 4593] (DMD 2.047) Access Violation in unittest build
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 7 13:44:36 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4593
--- Comment #4 from Adrian Matoga <epi at atari8.info> 2010-08-07 13:44:35 PDT ---
Hmm, this seems to be a lot more subtle thing.
Could you try the following:
image.d:
--------------------
import std.string;
import std.contracts;
import std.conv;
interface Image
{
static Image open(string path, string type, bool readOnly = true)
{
auto img = newObj(path, type);
img.openImpl(path, readOnly);
return img;
}
static Image open(string path, bool readOnly = true)
{
return open(path, autoType(path), readOnly);
}
protected:
void openImpl(string path, bool readOnly);
private:
static Image newObj(string path, string type)
{
auto image = cast(Image) Object.factory(tolower(type) ~ "." ~
capitalize(type) ~ "Image");
version (unittest)
{
if (image is null)
image = cast(Image) Object.factory("image." ~ capitalize(type)
~ "Image");
}
enforce(image, "Unknown image format: " ~ type);
return image;
}
static string autoType(string path)
{
auto sp = path.split(".");
return sp.length ? sp[$ - 1] : "";
}
}
--------------------
main.d
--------------------
import std.stdio;
void main()
{
writeln("Hello world!");
}
--------------------
dmd -oftest.exe -unittest main.d image.d
For me, this also fails on XP SP3 (x86).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list