The problem persists without the mixin and the template: class C { int a; } struct Foo { void foo() { auto sz = C.a.sizeof; writefln("sz: %s", sz); } } static this() { Foo f; f.foo(); } Error: this for a needs to be type C not type Foo