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

           Summary: TDPL Example on P401 & 402 doesn't compile on D2.047,
                    2.046, 2.045, 2.044. Seems to be a problem involves
                    tuples and []
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: gareth....@gmail.com


--- Comment #0 from gareth....@gmail.com 2010-07-09 14:52:07 PDT ---
The example:

import std.concurrency, std.stdio, std.contracts; /*std.contracts was missing
in the book, but this is fairly trivial change*/

void main() {
    auto low = 0, high = 100;
    auto tid = spawn(&writer);
    foreach(i; low .. high) {
        writeln("Main thread: ",i);
        tid.send(thisTid,i);
        enforce(receiveOnly!Tid() == tid);
    }
}

void writer() {
    for(;;) {
        auto msg = receiveOnly!(Tid,int)();
        writeln("Secondary thread: ", msg[1]);  //Line 17
        msg[0].send(thisTid);                   //Line 18
    }
}

thread_test.d(17): Error: no [] operator overload for type Tuple!(Tid,int)
thread_test.d(18): Error: no [] operator overload for type Tuple!(Tid,int)


Trying to compile with version 2.044-2.046 produces these errors
thread_test.d(10): Error: template std.typecons.Tuple!(Tid).Tuple.opEquals(T)
if (is(typeof(T.field))) does not match any function template declaration
thread_test.d(10): Error: template std.typecons.Tuple!(Tid).Tuple.opEquals(T)
if (is(typeof(T.field))) cannot deduce template function from argument types
!()(Tid)

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

Reply via email to