How's this? import std.stdio; import std.conv;
void staticAssert(alias exp, string message, string file = __FILE__, int line = __LINE__)() { static if (!exp) { pragma(msg, file ~ ":(" ~ to!string(line) ~ ") " ~ "staticAssert: " ~ to!string(message)); assert(0); } } void main() { enum x = false; staticAssert!(x, "Oh no we failed!"); int y; }