std.variant holding bigger structs and std.concurrency message limitation

Tavi Cacina octavian.cacina at outlook.com
Sat Apr 27 04:37:37 PDT 2013


is it a bug the fact that a Variant may be initialized with a 
struct bigger than 32 bytes? Even if this does function, it is 
not consistent because you can not assign such an 'inflated' 
variant to another one, assertion. This affects the max size of a 
std.concurrency message (right now it is not specified that such 
restriction exists)

---
import std.variant;

struct S
{
   int[9] s;
}

void main()
{
   Variant v1, v2; // maximum size 32 bytes
   v1 = S(); // works, even if sizeof(S) > 32
   v2 = v1; // AssertError: target must be non-null
}
---


More information about the Digitalmars-d mailing list