Re: Template overload causing an error even when a better non-template match is found

2013-08-30 Thread Andrej Mitrovic
On 8/30/13, Andrej Mitrovic wrote: > On 8/30/13, Andrej Mitrovic wrote: >> I'm not looking for a workaround (there's plenty of ways to work >> around this) > > Here's one way: Sorry, better version, the second function doesn't need to be a template (in git-head anyway): void opAssign(T)(T t

Re: Template overload causing an error even when a better non-template match is found

2013-08-30 Thread Andrej Mitrovic
On 8/30/13, Andrej Mitrovic wrote: > I'm not looking for a workaround (there's plenty of ways to work > around this) Here's one way: void opAssign(T)(T t) if (is(typeof(Constraint!T)) && Constraint!T) { pragma(msg, "T"); } void opAssign(T)(T t) if (is(T =

Template overload causing an error even when a better non-template match is found

2013-08-30 Thread Andrej Mitrovic
You're going to need DMD git-head to run this reduced example: - struct S { void opAssign(T)(T t) if (Constraint!T) { } void opAssign(typeof(null)) { } template Constraint(T) if (is(T == int)) { enum bool Constraint = false; } } vo