opDispatch and UFCS
Kenji Hara
k.hara.pg at gmail.com
Tue Jul 2 20:44:12 PDT 2013
On Tuesday, 2 July 2013 at 00:45:23 UTC, cal wrote:
> import std.conv, std.stdio, std.algorithm;
>
> struct S {
> void opDispatch(string s, T...)(T t) if
> (s.startsWith("foo")) {
> writeln(s);
> }
> }
>
> void main() {
> S s;
> s.foo();
> auto p = s.to!string(); // Error: s.opDispatch!("to") isn't
> a template
> }
>
> Should the constraint on opDispatch allow the UFCS "to" call on
> S?
That's a compiler bug.
http://d.puremagic.com/issues/show_bug.cgi?id=10526
Kenji Hara
More information about the Digitalmars-d-learn
mailing list