https://issues.dlang.org/show_bug.cgi?id=12597
Bastiaan Veelo <basti...@veelo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |basti...@veelo.net --- Comment #16 from Bastiaan Veelo <basti...@veelo.net> --- (In reply to bearophile_hugs from comment #15) > (In reply to bearophile_hugs from comment #14) > > > > auto typedefVal(T)(T val) > > > { > > > return cast(TypedefType!T)val; > > > } > > > > Yes, this ER asks for such safe function in Phobos. > > But it's better to add a template constraint to that T to be sure it's a > Typedef. No need: /// Instantiating with a non-Typedef will return that type static assert(is(TypedefType!int == int)); --