Try this.
import std.gc
struct heapmalloc(T) {
static T* opCall(U...)(U u) {
auto res = cast(T*) malloc(T.sizeof);
(*res) = T(u);
return res;
}
}
struct Foo {
int a;
float b;
}
void main() {
auto heapfoo = heapmalloc!(Foo)(1984, 3.14159);
}