D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7660 - toImpl conflict in std.conv
Summary: toImpl conflict in std.conv
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-07 10:38 UTC by David
Modified: 2012-04-21 00:22 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David 2012-03-07 10:38:41 UTC
/usr/include/d/std/conv.d(244): Error: template std.conv.toImpl(T,S) if (isImplicitlyConvertible!(S,T)) toImpl(T,S) if (isImplicitlyConvertible!(S,T)) matches more than one template declaration, /usr/include/d/std/conv.d(932):toImpl(T,S) if (is(S : Object) && isSomeString!(T)) and /usr/include/d/std/conv.d(965):toImpl(T,S) if (is(S == struct) && is(typeof(&S.init.toString)) && isSomeString!(T))


-----
import std.conv : to;


class Bar {}

struct Foo {
    Bar bar;
    alias bar this;
    
    static Foo c() {
        Foo ret;
        ret.bar = new Bar();
        return ret;
    }
}

void main() {
    Foo foo = Foo.c();
    
    to!string(foo);
}
-----
Comment 2 github-bugzilla 2012-04-20 22:24:30 UTC
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/30d9405ad48cbaef934af897e85ff8514a33e579
added tests for bug 7660

https://github.com/D-Programming-Language/phobos/commit/803aa7ccb04dae273169b70fbff4ecdcd2ada884
Merge pull request #482 from Dav1dde/conv2

Bug 7660, incorrect toImpl overload for struct with alias this to class