hm, the moment of pressing the "send" button is often enough a moment of enlightment :) version( D_Version2 ){ mixin("invariant(T)[] _idup(T)( T[] str ){ return str.idup; }"); } else { // D1 String _idup( char[] str ){ return str.dup; } } str._idup(); // compiles with D1+D2