Bug 13284 – [dmd 2.066-rc2] Cannot match shared classes at receive

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-08-11T13:15:00Z
Last change time
2014-08-21T18:22:14Z
Keywords
pull
Assigned to
nobody
Creator
NCrashed

Comments

Comment #0 by NCrashed — 2014-08-11T13:15:39Z
Now cannot match shared classes at receive callbacks (will fallback to Variant case): ``` import std.stdio; import std.concurrency; import core.time; shared class A {} void thread() { while(true) { receiveTimeout(dur!"msecs"(1000), (shared(A) a) { writeln("Got a!"); return; } , (Variant v) { assert(false, "Unknown message!"); }); } } void main() { auto tid = spawn(&thread); auto a = new shared A(); tid.send(a); } ``` Platform: 3.15.8-200.fc20.x86_64 dmd: DMD64 D Compiler v2.066.0-rc2
Comment #1 by k.hara.pg — 2014-08-11T15:03:08Z
With 2.055 - 2.065 and git-head, the code produces same result: [email protected](14): Unknown message! Which dmd version had produced "Got a!" message?
Comment #2 by NCrashed — 2014-08-11T15:24:08Z
My fault, I've truncated important part while reducing: ``` import std.stdio; import std.concurrency; import core.time; import core.thread; synchronized class A {} void thread(Tid parent) { bool stop = false; try { while(!stop) { receiveTimeout(dur!"msecs"(1000), (shared A a) { writeln("Got a!"); parent.send(true); stop = true; } , (Variant v) { assert(false, "Unhandled message!"); }); } } catch(Throwable th) { writeln(th.toString); parent.send(true); } } void main() { auto tid = spawn(&thread, thisTid); auto a = new shared A(); tid.send(a); receiveOnly!bool(); } ``` The code is printing "Got a!" on 2.065 and fails on 2.066-rc2.
Comment #3 by NCrashed — 2014-08-11T15:26:55Z
Note: if main terminates, than the "Unknown message!" assertion is called. The parent termination exception is caught by Variant one.
Comment #4 by k.hara.pg — 2014-08-12T13:08:04Z
Reduced test case: import std.variant; void main() { auto a = new shared A(); Variant v; v = a; assert(v.get!(shared A) is a); // --> succeeds with 2.065, but fails with 2.066 } The regression was introduced by: https://github.com/D-Programming-Language/phobos/pull/1869 Phobos fix: https://github.com/D-Programming-Language/phobos/pull/2418
Comment #5 by github-bugzilla — 2014-08-12T23:08:43Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/a846ecb18b255271802adf0fdc59dae1c8dba094 fix Issue 13284 - Cannot match shared classes at receive https://github.com/D-Programming-Language/phobos/commit/06ca7ce82f7870c100d12fb0ed7608d3df0edbb6 Merge pull request #2418 from 9rnsr/fix13284 [REG2.066a] Issue 13284 - Cannot match shared classes at receive
Comment #6 by github-bugzilla — 2014-08-13T15:30:00Z
Commit pushed to 2.066 at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/af2bd8b0af116373e21555c2c2d9ccb82ba59876 Merge pull request #2418 from 9rnsr/fix13284 [REG2.066a] Issue 13284 - Cannot match shared classes at receive
Comment #7 by github-bugzilla — 2014-08-21T18:22:14Z