import std.stdio; class C(T) { T val; } class D { mixin C!bool; } int main() { auto d = new D; writeln(d.val); return 0; } This fails to compile (no val in D), yet if defining C as: template C(T) { T val; } It works. This is rather silly as it forces me to write wrapper classes that forward to a template.
There's no such thing as a class mixin. One mixes in template instances, not classes. Since a class template is just syntactic sugar for a template with an eponymous class as its only member, the compiler expands it to: class D { class C { bool val; } } So of course there's no such thing as d.val.