digitalmars.D - is(this == bug) ???
- dsimcha (16/16) Apr 01 2009 void doStuff(T)(T arg)
- dsimcha (4/20) Apr 01 2009 (Slapping forehead)
- Andrei Alexandrescu (6/28) Apr 01 2009 No, no, always mind. The parameter name should be visible in the
void doStuff(T)(T arg) if(is(typeof(arg))) { } void main() { doStuff(1); } Results: test7.d|6|template test7.doStuff(T) if (is(typeof(arg))) does not match any function template declaration| test7.d|6|template test7.doStuff(T) if (is(typeof(arg))) cannot deduce template function from argument types !()(int)| This code does not compile with 2.027, 2.026, or 2.016 (the first version that had constraints). If it is, in fact, a bug, I find it amazing that it's apparently taken over half a year for anyone to notice. (Searching bugzilla for "constraints" yields nothing.) If it's not a bug, then I can't for the life of me figure out why it won't compile.
Apr 01 2009
== Quote from dsimcha (dsimcha yahoo.com)'s articlevoid doStuff(T)(T arg) if(is(typeof(arg))) { } void main() { doStuff(1); } Results: test7.d|6|template test7.doStuff(T) if (is(typeof(arg))) does not match any function template declaration| test7.d|6|template test7.doStuff(T) if (is(typeof(arg))) cannot deduce template function from argument types !()(int)| This code does not compile with 2.027, 2.026, or 2.016 (the first version that had constraints). If it is, in fact, a bug, I find it amazing that it's apparently taken over half a year for anyone to notice. (Searching bugzilla for "constraints" yields nothing.) If it's not a bug, then I can't for the life of me figure out why it won't compile.(Slapping forehead) Never mind. After struggling with this for an hour, I realized that arg is not in scope when the constraint is evaluated.
Apr 01 2009
dsimcha wrote:== Quote from dsimcha (dsimcha yahoo.com)'s articleNo, no, always mind. The parameter name should be visible in the if-constraint of a template. Please file a bug. Also the parameter names should be visible in the return type (if it uses e.g. sizeof or typeof). I think I filed that. Andreivoid doStuff(T)(T arg) if(is(typeof(arg))) { } void main() { doStuff(1); } Results: test7.d|6|template test7.doStuff(T) if (is(typeof(arg))) does not match any function template declaration| test7.d|6|template test7.doStuff(T) if (is(typeof(arg))) cannot deduce template function from argument types !()(int)| This code does not compile with 2.027, 2.026, or 2.016 (the first version that had constraints). If it is, in fact, a bug, I find it amazing that it's apparently taken over half a year for anyone to notice. (Searching bugzilla for "constraints" yields nothing.) If it's not a bug, then I can't for the life of me figure out why it won't compile.(Slapping forehead) Never mind. After struggling with this for an hour, I realized that arg is not in scope when the constraint is evaluated.
Apr 01 2009