static foreach(k, p; AliasSeq!(this, s)) {{ p.foo(); // Fails even if this line is removed }} this not known at compile time. replace s with this and it works! s is an argument which is also not known at compile time(generally). Should work with this. Just "simplifying" this.foo(); s.foo(); (obviously more complex code)