Help needed for "recursive template expansion error"
simen.kjaras at gmail.com
Tue Oct 22 08:42:48 UTC 2019
On Tuesday, 22 October 2019 at 08:16:47 UTC, Anthony Abeo wrote:
> On Monday, 21 October 2019 at 18:45:44 UTC, Nicholas Wilson
>> On Monday, 21 October 2019 at 18:14:11 UTC, Anthony Abeo wrote:
>> Please post such questions to the learn forum in the future.
>> One way to fix this is to use the `This` type to perform type
>> substitution in the Algebraic which refers to the final type
>> of the Algebraic, used like `alias F = Algebraic!(int, string,
>> This)`. Where F is either an int, a string or an array of
>> You could probably remove `attributes` from code and use
>> alias ATTR_INFO = Algebraic!(SourceFile, ConstantValue,
>> Excepsion, Tuple!(Code,This), LineNumberTable,
> - Please post such questions to the learn forum in the future.
> Noted. I will do that next time.
> I tried your suggestion and it fails silently; no error message
> / stack trace.
I'd suggest using SumType
(https://code.dlang.org/packages/sumtype) instead of std.variant,
as the latter has its share of problems.
Otherwise, this kinda works, but can hardly be called anything
but a horrible hack:
alias ATTR_INFO = Algebraic!(SourceFile, ConstantValue,
Tuple!(size_t, size_t, size_t, size_t) exception_table;
private ubyte _attributes;
ref ATTR_INFO attributes(return ref Code code)
It will need some fixing if you have any destructors, as Code
treats those ATTR_INFOs as just a bunch of bytes, but it will
make the code compile and it might be good enough. Seriously
though, check out SumType instead.
More information about the Digitalmars-d