On Wednesday, 11 March 2020 at 12:43:28 UTC, mark wrote:
On Wednesday, 11 March 2020 at 12:22:21 UTC, Simen Kjærås wrote:
On Wednesday, 11 March 2020 at 09:29:54 UTC, mark wrote:
[snip]
Fascinating. It works just fine when compiling for 32-bit
targets with DMD on Windows, but not for 64-bit targets, nor
when compiling with LDC. Apparently, this difference is due to
DMD supporting 80-bit reals, and thus giving a different size
to Variant (VariantN!20 on DMD on Windows, VariantN!16 or
VariantN!32 elsewhere). There's a bug in VariantN that then
causes the compilation to fail
(https://issues.dlang.org/show_bug.cgi?id=20666).
The issue at hand then, is that Deb is too big until that
issue if fixed. The simple solution to this is to allocate Deb
on the heap with new and pass pointers instead of instances
directly. Since you are already calling .dup whenever you pass
a Deb somewhere, you can simply modify .dup to return a Deb*
and the receive function to receive a Deb*, and I think you
should be good to go.
I did that and it compiles & runs, but no Debs get added to the
collection.
See https://github.com/mark-summerfield/d-debtest-experiment --
the 'mto' version is the one with your fixes.
Yeah, I forgot we cast to immutable to be able to send, so
receive has to receive immutable(Deb)*, after which you can call
deb.dup to get a mutable copy:
receive(
(immutable(Deb)* deb) { debForName[deb.name] = deb.dup; },
(DoneMessage m) { jobs--; }
);
--
Simen