On Thu, 02 Sep 2010 11:11:52 -0700, Brad Roberts wrote: > On 9/2/2010 5:59 AM, Simen kjaeraas wrote: >> void bar(T)(const T x, out T y) {} >> >> void main() { >> const int s1; >> int s2; >> bar(s1, s2); >> } >> >> It seems DMD is confused by const(int) being such a nice fit for the >> first parameter. This might have to do with s2 = s1 being ok. >> >> It is probably worth noting that this works: >> >> >> import std.traits; >> >> void bar(T)(const T x, out T y) {} >> >> void main() { >> const int s1; >> int s2; >> bar!(CommonType!(s1,s2))(s1, s2); >> } > > http://d.puremagic.com/issues/show_bug.cgi?id=4594
Right! its dmd bug in implicit instantiation: void bar(T)(const T x, T y) {} void main () { const int s1; int s2; bar!(const int)(s1, s2); // pass ok bar!(int)(s1, s2); // pass ok bar(s1, s2); // error }