On Thursday, 11 July 2013 at 11:56:16 UTC, Gary Willoughby wrote:
Any idea what i'm doing wrong?

Function templates cannot be virtual. You're allowed to declare non-virtual members of interfaces, but they must be defined. That means static functions, final functions and function templates can be declared in interfaces as long as they are defined. This is a feature of D.

However, in my opinion, it's a bug that you're allowed to declare a function template (when using the shortcut syntax) without defining it, whether in an interface or not. This is a rather natural bug though, due to the nature of function templates:

void a()();

is equivalent of:

template a() { void a(); }

Perhaps it makes sense to allow the declaration without definition when the template and function are explicitly separated (can anyone think of a case where this is useful? Maybe mixin-related?), but when using the former syntax - the function template syntax - I don't think it makes any sense.

Whether or not function templates in general should be declarable without a definition, it's definitely a bug that you can do it in an interface.

Reply via email to