Closed elrandar closed 10 months ago
@elrandar was the discussion which lead to that fix public? If yes then it would be cool to add a link to it. Otherwise we'll merge as is.
Its in the public dlang
discord server, but not really accessible for anyone that is not already a member.
Here is a link to it.
Copy pasted contents of the relevant messages (accessed 23/11/23):
Ok, I found the problem.
std.traits.hasElaborateDestructor
to check whether it needs to run the destructor of the stored value.hasElaborateDestructor
iterates over its fields to see if any of them have a destructor.(spec:1) /usr/include/dmd/druntime/import/core/internal/traits.d(16): Error: unable to determine fields of `Bar` because of forward references
Anyway, the good news is that there is a workaround. You can make the code compile by wrapping your SumType in a struct with an alias this
declaration:
[...]
if you wrap the SumType up in a struct, the name lookup finds struct s and stops there, without looking inside.