[Issue 7263] New: Tuple slicing + -O switch causes "used before set" error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 9 19:24:23 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7263

           Summary: Tuple slicing + -O switch causes "used before set"
                    error
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2012-01-09 19:24:23 PST ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list