Bug 8183 – template bug?

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-02T00:47:00Z
Last change time
2015-06-10T02:35:31Z
Assigned to
nobody
Creator
zheny

Comments

Comment #0 by zheny — 2012-06-02T00:47:25Z
this doesn't work: template bind(alias indeces) { static if(is(typeof(indeces) : int[])) { auto bind(D,V...)(D dg,V values) { static if(is(D d : R delegate(U), R, U...) && is(V == Combination!(indeces,ParameterTypeTuple!D))) { static if(indeces.length > 1) return bind!(update!(indeces,indeces[0])[1..$]).bind(Curry!(indeces[0])(dg,values[0]),values[1..$]); else static if(indeces.length == 1) return Curry!(indeces[0])(dg,values[0]); } } } } while this works : class Bind(alias indeces) { static if(is(typeof(indeces) : int[])) { static auto opCall(D,V...)(D dg,V values) { static if(is(D d : R delegate(U), R, U...) && is(V == Combination!(indeces,ParameterTypeTuple!D))) { static if(indeces.length > 1) return Bind!(update!(indeces,indeces[0])[1..$])(Curry!(indeces[0])(dg,values[0]),values[1..$]); else return Curry!(indeces[0])(dg,values[0]); } } } }
Comment #1 by k.hara.pg — 2015-06-10T02:35:31Z
The presented code is not enough to see the issue. - bind template is not instantiated in the code. Therefore it's merely a template definition, and it is compiled successfully. - Lack of surrounding context. there's not update and Curry templates, imports (maybe import std.traits; for ParameterTypeTuple ?)