https://issues.dlang.org/show_bug.cgi?id=23268
--- Comment #2 from RazvanN <[email protected]> --- Additional information: a reduction of the phobos code that manifests in this case is: void main() { clamp(short.init, short.init, cast(const)short.init); } T1 clamp(T1, T2, T3)(T1 val, T2 lower, T3 upper) if (is(typeof(val < lower ? lower : val > upper ? upper : val) : T1)) { return val < lower ? lower : val > upper ? upper : val; } The problem is that the resulting type of the ternary expression is int instead of shared. It wrongfully casts the operands to int, as a result of 16235. --
