On Friday, May 19, 2017 8:31:52 PM PDT Stefan Koch via Digitalmars-d wrote: > On Friday, 19 May 2017 at 20:23:16 UTC, Dominikus Dittes Scherkl > > wrote: > > On Friday, 19 May 2017 at 17:47:42 UTC, Stefan Koch wrote: > >> On Friday, 19 May 2017 at 17:34:28 UTC, Dominikus Dittes > >> > >> Scherkl wrote: > >>> [...] > >> > >> the static assert tells what's going on. > >> It it does result in a simple overload not found. > > > > Hm. Maybe in this case it's ok, because enum is pretty much all > > that can be expected as argument to "enumToString". But > > normally I would calling not using a constraint "stealing > > overload possibilities", because it would not be possible to > > overload the same function for a different type if you use this > > kind of assert. > > And the error message is not really better. > > You can still overload :) > D has SFINAE
Wait, what? Doesn't D specifically _not_ have SFINAE? You can use static if to test what compiles, and the branch whose condition compiles is then the on that gets compiled in, which kind of emulates what you'd get with SFINAE, but that's not really the same as SFINAE, which just outright picks the the template specialization which happens to compile while letting the others that don't compile not generate errors. D complains when you have multiple, matching templates. So, what do you mean that D has SFINAE? - Jonathan M Davis
