[Issue 9272] opDispatch conflicts with UFCS on template functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jan 5 12:19:18 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9272
Simen Kjaeraas <simen.kjaras at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simen.kjaras at gmail.com
--- Comment #5 from Simen Kjaeraas <simen.kjaras at gmail.com> 2013-01-05 12:19:17 PST ---
(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.
--
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