https://issues.dlang.org/show_bug.cgi?id=20080
Simen Kjaeraas <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |[email protected] Resolution|--- |DUPLICATE --- Comment #1 from Simen Kjaeraas <[email protected]> --- This is by design, and can easily be fixed with an alias: mixin template Thing( ) { public void writeAThing( float val ) { import std.stdio : writeln; writeln( val ); } } struct ProperThing { public void writeAThing( int val ) { import std.stdio : writeln; writeln( val ); } // Note that we must give the mixin a name: mixin Thing!() f; // Then this line adds it to the overload set: alias f.writeAThing writeAThing; } void main { ProperThing thing; thing.writeAThing( 42.0f ); } It's even possible to automate this with reflection: string aliasAll(alias sym)() { enum symName = __traits(identifier, sym); string result = ""; foreach (e; __traits(allMembers, sym)) result ~= "alias "~symName~"."~e~" "~e~";"; return result; } And you'd use it like this: mixin Thing!() f; mixin(aliasAll!f); *** This issue has been marked as a duplicate of issue 2157 *** --
