Bug 771 – template func returns delegate w. param list from tuple and type, odd compiler error
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2006-12-29T21:24:00Z
Last change time
2014-02-15T13:21:11Z
Assigned to
bugzilla
Creator
default_357-line
Comments
Comment #0 by default_357-line — 2006-12-29T21:24:33Z
Trying to compile the following code:
void delegate(T, S) Concat(S, T...)(void delegate(T) one, void delegate(S) two) {
return( delegate void(T t, S s){} );
}
void main() {
void delegate(char, char, int) wtf=Concat(
delegate void(char a, char b) {},
delegate void(int lol) {}
);
}
I run into the somewhat confusing compiler error:
test2.d(24): Error: cannot implicitly convert expression ((Concat)(__dgliteral2, __dgliteral3)) of type void delegate((char _param_0, char _param_1), S) to void delegate(char, char, int)
So it looks as if the S type doesn't get substituted at all.
If this usage of tuples is invalid, please say so in the docs. Otherwise, recommendations for workarounds or a solution would be greatly appreciated.
Greetings.