Aliases to mutable thread-local data not allowed [testable source code]

Simen Kjærås simen.kjaras at gmail.com
Wed Mar 11 12:22:21 UTC 2020


On Wednesday, 11 March 2020 at 09:29:54 UTC, mark wrote:
> Hi Simen,
>
> I think you must have done something else but didn't mention to 
> get it to compile. I did the exact changes you said and it 
> wouldn't compile. Here's what I get with changes mentioned 
> below (with new full source):

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.

--
   Simen


More information about the Digitalmars-d-learn mailing list