Thread overview |
---|
November 26, 2006 [Issue 599] New: ExpressionTuple doesn't match template's alias parameters | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=599 Summary: ExpressionTuple doesn't match template's alias parameters Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: lovesyao@hotmail.com template test2(alias s){ alias s[0] test2; } void test(T...)(T tl){ alias tl tl2;//ok assert(test2!(tl)==0);//doesn't match alias template declaration } void main(){ test(0,"a",'a'); } -- |
September 10, 2007 [Issue 599] ExpressionTuple doesn't match template's alias parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=599 smjg@iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Keywords| |rejects-valid ------- Comment #1 from smjg@iname.com 2007-09-10 05:56 ------- Here's what I get (DMD 0.121, Windows): bz599.d(7): template instance test2!(_param_0,_param_1,_param_2) does not match any template declaration bz599.d(7): Error: void has no value bz599.d(7): Error: incompatible types for ((test2!(_param_0,_param_1,_param_2)) == (0)): 'void' and 'int' bz599.d(11): template instance bz599.test!(int,char[1u],char) error instantiating The problem seems to be that it doesn't like a tuple as a template alias parameter. From what I can make out of the spec, it ought to work. -- |
September 10, 2007 [Issue 599] ExpressionTuple doesn't match template's alias parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=599 ------- Comment #2 from smjg@iname.com 2007-09-10 06:11 ------- On second thoughts, it seems the problem is that test2!(t1) expands to test2!(0, "a", 'a'), which is three parameters, whereas (alias s) is only one. Still, it ought to be possible to pass tuples as alias parameters. -- |
June 30, 2008 [Issue 599] ExpressionTuple doesn't match template's alias parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=599 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #3 from bugzilla@digitalmars.com 2008-06-30 02:08 ------- Tuples are expanded before arguments are matched to parameters, so they cannot be passed as alias parameters. This is by design. -- |
June 30, 2008 [Issue 599] ExpressionTuple doesn't match template's alias parameters | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=599 ------- Comment #4 from shro8822@vandals.uidaho.edu 2008-06-30 11:58 ------- If you need to allow someone to do this for your template, try this: struct Tpack(T...) { static alias T Tpl; } test2!(Tpack!(T)) template test2(alias s){ alias s.Tpl[0] test2; } (Or some variate of that, I didn't test this but have made the trick work before) -- |
Copyright © 1999-2021 by the D Language Foundation