Bug 7263 – Tuple indexing/slicing + -O switch causes "used before set" error

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-01-09T19:24:00Z
Last change time
2012-02-17T03:42:39Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2012-01-09T19:24:23Z
Sample code: ---- template TypeTuple(T...){ alias T TypeTuple; } struct tuple { TypeTuple!(int, int) field; alias field this; } auto front(T)(ref T arr){ return arr[0]; } void main() { auto bars = [tuple(0, 0), tuple(1, 1)]; auto spam = bars.front[1..2]; // } Output: ---- Error: variable __tup3 used before set
Comment #1 by k.hara.pg — 2012-01-09T20:03:31Z
Comment #2 by k.hara.pg — 2012-01-12T00:59:46Z
Tuple indexing has same problem. template TypeTuple(T...){ alias T TypeTuple; } struct tuple { TypeTuple!(int, int) field; alias field this; } auto front(T)(ref T arr){ return arr[0]; } void main() { auto bars = [tuple(0, 0), tuple(1, 1)]; auto spam1 = bars.front[1]; // indexing auto spam2 = bars.front[1..2]; // slicing }
Comment #3 by yebblies — 2012-02-17T03:42:39Z