[Issue 9272] opDispatch conflicts with UFCS on template functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jan 6 04:49:59 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9272
--- Comment #6 from Nicolas Sicard <dransic at gmail.com> 2013-01-06 04:49:57 PST ---
(In reply to comment #5)
> (In reply to comment #2)
> > This works, where opDispatch does not take precedence:
> > ---
> > struct Foo {
> > void opDispatch(string s)() {}
> > }
> >
> > void baz(Foo f) {}
> >
> > unittest {
> > Foo foo;
> > foo.baz(); // OK
> > }
>
> Except, of course, opDispatch *does* take precedence here. Try this instead:
>
> import std.stdio : writeln;
>
> struct Foo {
> void opDispatch(string s)() { writeln("opDispatch: ", s); }
> }
>
> void baz(Foo f) { writeln("function: baz"); }
>
> void main( ) {
> Foo foo;
> foo.baz(); // OK
> }
>
> I can assure you it prints opDispatch: baz.
Ah! I was trapped by the minimalism of my example. OK thanks.
--
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