class A { void foo(this T)() { } static void bar(this T)() { } template baz(this T) { static void baz() { } } } class B : A { } void main() { B b; b.foo(); // ok B.bar(); //fail b.bar(); // fail b.baz(); // ok B.baz(); // fail } onlineapp.d(22): Error: template onlineapp.A.bar cannot deduce function from argument types !()(), candidates are: onlineapp.d(5): bar(this T)() onlineapp.d(23): Error: template onlineapp.A.bar cannot deduce function from argument types !()(), candidates are: onlineapp.d(5): bar(this T)() onlineapp.d(26): Error: template onlineapp.A.baz cannot deduce function from argument types !()(), candidates are: onlineapp.d(8): baz(this T)() run.dlang.io: https://run.dlang.io/is/Hme9vp Accessing the static type of a class in the context of a base class is an extremely useful feature, and there is no reason to restrict it to just non-static functions, precluding valid use cases like factory function generation etc.
*** Issue 20816 has been marked as a duplicate of this issue. ***
in the duplicate i argue from the spec that this should work too
*** This issue has been marked as a duplicate of issue 10488 ***