In a wrapper generator I am writing, I need to check if some member function foo() has been overridden in a subclass.
Thanks to the help of maxter at #d, I currently have this for D1: template addressOf( alias fn ) { const addressOf = &fn; } class A { void foo() {} final void bar() { auto dg = &foo; if ( addressOf!( foo ) == dg.funcptr ) { Stdout( "not overridden" ).newline; } else { Stdout( "overridden" ).newline; } } } class B : A { override void foo() {} } void main() { A a = new A(); a.bar; A b = new B(); b.bar; } Although the code works fine with DMD, LDC complains that »this« is needed to evaluate &foo in addressOf. Is this a bug in LDC or in fact illegal code which DMD happens to erroneously accept? Are there any less hackish ways to perform the check? Thanks, klickverbot