[Issue 5719] [patch] std.conv.to should support structs with custom converters in addition to objects

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 1 13:09:22 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5719



--- Comment #1 from Rob Jacques <sandford at jhu.edu> 2011-07-01 13:04:20 PDT ---
I've noticed that with generic code that

Target toImpl(Target, Source)(Source value)
if (implicitlyConverts!(Source, Target))

can cause an error via multiple template matches with

T toImpl(T, S)(S value) if (is(S : Object) && is(T : Object))

and

T toImpl(T, S)(S value)
    if (((is(S : Object) && !is(T : Object)) || is(S == struct))
    && !isSomeString!T && is(typeof(S.init.to!(T)()) : T))

Both issues can be simply fixed by adding an additional template constraint:
    && !implicitlyConverts!(S,T)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list