[Issue 6585] New: std.variant cannot handle shared arrays
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Aug 31 18:40:01 PDT 2011
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=6585
           Summary: std.variant cannot handle shared arrays
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: code at klickverbot.at
--- Comment #0 from klickverbot <code at klickverbot.at> 2011-08-31 18:39:54 PDT ---
As discovered during the review for Jonas Drewson's libcurl wrapper,
std.concurrency (correctly, according to TDPL) accepts shared arrays, but
cannot handle them internally:
---
import std.concurrency;
void main() {
  auto tid = spawn(function(){});
  send(tid, cast(shared(int)[])null);
}
---
---
std/variant.d(529): Error: function core.stdc.string.memcpy (void* s1, in
const(void*) s2, uint n) is not callable using argument types
(ubyte[32u]*,shared(int)*,uint)
std/variant.d(529): Error: cannot implicitly convert expression (& rhs) of type
shared(int)* to const(void*)
---
>From the error message, the problem seems std.variant trying to copy a
shared(int) to another in its opIndex implementation using memcpy(&target,
&source, source.sizeof). This fails because shared(int)* isn't implicitly
convertible to const(void*).
The issue can also be demonstrated by the following example directly using
std.variant:
---
import std.variant;
void main() {
  shared(int)[] array;
  auto v = Variant(array);
}
---
-- 
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