[Issue 4856] New: opDispatch does not work with specified template parameters
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 12 18:09:35 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4856
Summary: opDispatch does not work with specified template
parameters
Product: D
Version: D2
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: guillaume.benny at sympatico.ca
--- Comment #0 from Guillaume Benny <guillaume.benny at sympatico.ca> 2010-09-12 18:09:06 PDT ---
opDispatch does accept additional template parameters but they cannot be
specified:
====
module test.d;
import std.stdio;
struct DispatchTest {
void opDispatch(string name, string otherName)() {
writeln(name, ":", otherName);
}
}
void main() {
DispatchTest t;
//t.testName!("testOtherName")();
t.opDispatch!("testName", "testOtherName")();
}
====
This compiles fine but if I remove the commented line, dmd (v2.048) tells
me:
test.d(13): Error: template instance opDispatch!("testName") does not match
template declaration opDispatch(string name,string otherName)
The error seems OK for a "normal" function, but for opDispatch, it seems
limiting to me: the first call should translate to the second.
Here's an other, similar, test:
====
module test.d;
import std.stdio;
struct DispatchTest {
void opDispatch(string name, T)(T t) {
writeln(name, ":", T.stringof);
}
}
void main() {
DispatchTest t;
//t.testName!(DispatchTest)(t);
t.testName(t);
}
====
Which gives, when uncommenting:
test.d(13): Error: template instance opDispatch!("testName") does not match
template declaration opDispatch(string name,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