digitalmars.D.bugs - [Issue 525] New: can't use array variable in tuple index
- d-bugmail puremagic.com (21/21) Nov 15 2006 http://d.puremagic.com/issues/show_bug.cgi?id=525
- Don Clugston (8/34) Nov 16 2006 This is because there's no constant folding of array indexes and slices.
- d-bugmail puremagic.com (12/12) Nov 16 2006 http://d.puremagic.com/issues/show_bug.cgi?id=525
- Don Clugston (5/22) Nov 17 2006 Interesting.
- d-bugmail puremagic.com (4/4) Nov 17 2006 http://d.puremagic.com/issues/show_bug.cgi?id=525
- d-bugmail puremagic.com (9/9) Nov 25 2006 http://d.puremagic.com/issues/show_bug.cgi?id=525
http://d.puremagic.com/issues/show_bug.cgi?id=525 Summary: can't use array variable in tuple index 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 import std.typetuple; const int[] test=[1]; alias TypeTuple!(ulong,uint,ushort,ubyte) tuple; static assert(is(tuple[1]==uint));//ok static assert(is(tuple[test[0]]==uint));//failed Output: tuple_bug.d(5): static assert (is((ulong, uint, ushort, ubyte)[void[0]] == uint)) is false --
Nov 15 2006
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=525 Summary: can't use array variable in tuple index 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 import std.typetuple; const int[] test=[1]; alias TypeTuple!(ulong,uint,ushort,ubyte) tuple; static assert(is(tuple[1]==uint));//ok static assert(is(tuple[test[0]]==uint));//failed Output: tuple_bug.d(5): static assert (is((ulong, uint, ushort, ubyte)[void[0]] == uint)) is falseThis is because there's no constant folding of array indexes and slices. A simpler example: --------- const int a[] = [1,2,3]; const int b = a[2]; --------- Error: non-constant expression (a)[2]
Nov 16 2006
http://d.puremagic.com/issues/show_bug.cgi?id=525 I dont think so. I update example. import std.typetuple; const char[] a="\x01"; const char b=a[0];//ok const char[] c="test"; static assert(c[a[0]]=='e');//ok alias TypeTuple!(ulong,uint,ushort,ubyte) tuple; static assert(is(tuple[1]==uint));//ok static assert(is(tuple[a[0]]==uint));//failed --
Nov 16 2006
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=525 I dont think so. I update example. import std.typetuple; const char[] a="\x01"; const char b=a[0];//ok const char[] c="test"; static assert(c[a[0]]=='e');//ok alias TypeTuple!(ulong,uint,ushort,ubyte) tuple; static assert(is(tuple[1]==uint));//ok static assert(is(tuple[a[0]]==uint));//failedInteresting. Does it work with static assert(is(tuple[b]==uint)); ?
Nov 17 2006
http://d.puremagic.com/issues/show_bug.cgi?id=525 it does. --
Nov 17 2006
http://d.puremagic.com/issues/show_bug.cgi?id=525 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed DMD 0.175 --
Nov 25 2006