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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 12 00:59:47 PST 2012


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


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Tuple slicing + -O switch   |Tuple indexing/slicing + -O
                   |causes "used before set"    |switch causes "used before
                   |error                       |set" error


--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> 2012-01-12 00:59:46 PST ---
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
}

-- 
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