← Back to index
|
Original Bugzilla link
Bug 2514 – indexing error in struct.tupleof[i]
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-12-13T14:33:00Z
Last change time
2014-03-01T00:36:27Z
Keywords
wrong-code
Assigned to
nobody
Creator
shro8822
Comments
Comment #0
by shro8822 — 2008-12-13T14:33:54Z
template Foo(T, uint n = 0) { static if(T.tupleof.length <= n) const char[] Foo = ""; else const char[] Foo = typeof(T.tupleof[n]).stringof ~ " " ~ Foo!(T,n+1); } import std.stdio; void main() { writef("%d, %s\n", __VERSION__, Foo!(S)); /// generates "int, int, int" } struct S { int i; uint j; float k; } for this, the following is a work around: - else const char[] Foo = typeof(T.tupleof[n]).stringof ~ " " ~ Foo!(T,n+1); + else const char[] Foo = typeof(T.tupleof)[n].stringof ~ " " ~ Foo!(T,n+1);
Comment #1
by clugdbug — 2010-08-25T12:40:16Z
Fixed in 2.023 and 1.039