[Issue 586] New: Cannot index tuple with non-type elements
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 23 03:38:29 PST 2006
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 at digitalmars.com
ReportedBy: kirklin.mcdonald at 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.
--
More information about the Digitalmars-d-bugs
mailing list