Turned out it was even easier to do than I expected: https://github.com/yebblies/dmd/commit/ed7a499d689940fd21d23bb658e97b1024a7d6be I'm not sure if delegate.funcptr should return a void* lvalue or a const(void)* rvalue though. The latter would allow you to cast away const and mess with it.