Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
November 23, 2006 [Issue 586] New: Cannot index tuple with non-type elements | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=586 Summary: Cannot index tuple with non-type elements Product: D Version: 0.174 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: kirklin.mcdonald@gmail.com Take the following code: template Tu(T ...) { alias T[1] Tu; // Line 2 } void foo() { } void main() { alias Tu!(real, int) T; // Works, no problem. alias Tu!(4, int) U; // Results in error. alias Tu!(foo, int) V; // Results in error. alias Tu!("a", int) W; // Results in error. } The error in all three cases is: test.d(2): tuple T is used as a type test.d(X): template instance test.Tu!(<whatever>, int) error instantiating Any tuple containing elements which are not types cannot be indexed. This limits certain kinds of advanced template code. Bug 533 is a consequence of this bug. Bug 582 is essentially the same bug, but refers to slicing tuples rather than indexing them. -- |
November 25, 2006 Re: [Issue 586] New: Cannot index tuple with non-type elements | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail Attachments: | d-bugmail@puremagic.com schrieb am 2006-11-23: > http://d.puremagic.com/issues/show_bug.cgi?id=586 > Take the following code: > > template Tu(T ...) { > alias T[1] Tu; // Line 2 > } > > void foo() { } > > void main() { > alias Tu!(real, int) T; // Works, no problem. > alias Tu!(4, int) U; // Results in error. > alias Tu!(foo, int) V; // Results in error. > alias Tu!("a", int) W; // Results in error. > } > > The error in all three cases is: > > test.d(2): tuple T is used as a type > test.d(X): template instance test.Tu!(<whatever>, int) error instantiating > > Any tuple containing elements which are not types cannot be indexed. This limits certain kinds of advanced template code. > > Bug 533 is a consequence of this bug. Bug 582 is essentially the same bug, but refers to slicing tuples rather than indexing them. Added to DStress as http://dstress.kuehne.cn/compile/t/tuple_04_A.d http://dstress.kuehne.cn/compile/t/tuple_04_B.d http://dstress.kuehne.cn/compile/t/tuple_04_C.d http://dstress.kuehne.cn/compile/t/tuple_04_D.d http://dstress.kuehne.cn/compile/t/tuple_04_E.d http://dstress.kuehne.cn/compile/t/tuple_04_F.d http://dstress.kuehne.cn/compile/t/tuple_04_G.d Thomas |
April 09, 2007 [Issue 586] Cannot index tuple with non-type elements | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=586 ------- Comment #2 from reiner.pope@gmail.com 2007-04-08 19:20 ------- This is even true for the perhaps simpler version, with a pure expression tuple: int F; template A(T...) { alias T[0] B; // Fails here } alias A!(F) C; aliases.d(5): tuple T is used as a type aliases.d(8): template instance aliases.A!(F) error instantiating -- |
April 27, 2007 [Issue 586] Cannot index tuple with non-type elements | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=586 thomas-dloop@kuehne.cn changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Windows |All ------- Comment #3 from thomas-dloop@kuehne.cn 2007-04-27 12:38 ------- Fixed DMD 1.013 -- |
June 30, 2008 [Issue 586] Cannot index tuple with non-type elements | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=586 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WORKSFORME ------- Comment #4 from bugzilla@digitalmars.com 2008-06-30 01:39 ------- Works in dmd 2.015 too. -- |
Copyright © 1999-2021 by the D Language Foundation