Given: template foo( T ) { T foo( T t ) { return t; } T foo( T t, T u ) { return t + u; } } This should not cause problems. Basically, if a template contains an eponymous overload set, the overload set should be considered its only member.
I think a recent fix enables templates with multiple members to still be used as eponymous templates, but I don't recall the Issue number..
In dmd2.058, eponymous template hides internal names (fixing bug 4675). But eponymous overload set isn't still allowed. Workaround: template foo( T ) { T foox( T t ) { return t; } T foox( T t, T u ) { return t + u; } alias foox foo; // bundle overloads as eponymous member. }
https://github.com/D-Programming-Language/dmd/pull/758
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/207e93a5f061e82f18ed7b0f21ea844ef1fec9cf fix Issue 5525 - Eponymous templates should allow for overloaded eponymous members https://github.com/D-Programming-Language/dmd/commit/3fa6179603c0b6a57b0baccd40bc2f6155255d0a Merge pull request #758 from 9rnsr/fix5525 Issue 5525 - Eponymous templates should allow for overloaded eponymous members
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/dd9bbbf78a8371dc21bbd1a0bd63b13dc88a8107 Remove workaround for issue 5525
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/a0dbea1d2c998c7c9da90bf9481c70999361221a Remove workaround for issue 5525