Thread overview
SumType! seemingly results in cryptic error, with dub suggesting to make an issue ticket
May 30, 2023
Gimbles
May 30, 2023
Gimbles
May 30, 2023
user456
May 30, 2023
Gimbles
May 30, 2023
Gimbles
May 30, 2023

My code is this

struct ConstValueIndex
{
    ushort const_value_index;
}

struct EnumConstValue
{
    ushort type_name_index;
    ushort const_name_index;
}

struct ClassInfoIndex
{
    ushort class_info_index;
}

struct AnnotationValue
{
    Annotation annotation_value;
}

struct ArrayValue
{
    ElementValue[] values;
}

alias ElementValue = SumType!(
    ConstValueIndex,
    EnumConstValue,
    ClassInfoIndex,
    AnnotationValue,
    ArrayValue,
);

It results in quite a cryptic error

Error: unknown, please file report on issues.dlang.org
/usr/include/dlang/dmd/std/meta.d(632,42): Error: template instance `std.sumtype.matchImpl!(Flag.yes, destroyIfOwner).matchImpl!(SumType!(ConstValueIndex, EnumConstValue, ClassInfoIndex, AnnotationValue, ArrayValue)).matchImpl.valueTypes!4LU.fun!0LU` error instantiating
/usr/include/dlang/dmd/std/sumtype.d(1931,32):        instantiated from here: `Map!(getType, 0LU)`
/usr/include/dlang/dmd/std/sumtype.d(1967,51):        instantiated from here: `valueTypes!4LU`
/usr/include/dlang/dmd/std/sumtype.d(1649,52):        instantiated from here: `matchImpl!(SumType!(ConstValueIndex, EnumConstValue, ClassInfoIndex, AnnotationValue, ArrayValue))`
/usr/include/dlang/dmd/std/sumtype.d(752,17):        instantiated from here: `match!(SumType!(ConstValueIndex, EnumConstValue, ClassInfoIndex, AnnotationValue, ArrayValue))`
source/parser/definitions/attributes.d(262,22):        instantiated from here: `SumType!(ConstValueIndex, EnumConstValue, ClassInfoIndex, AnnotationValue, ArrayValue)`
/usr/include/dlang/dmd/std/sumtype.d(1985,13):        while evaluating: `static assert((__error)(hid))`
Error /usr/bin/dmd failed with exit code 1.

(I tried all three compilers, happens in all)

Should I make an issue for this as it suggests?

May 30, 2023

On Tuesday, 30 May 2023 at 08:42:38 UTC, Gimbles wrote:

>

My code is this

struct ConstValueIndex
{
    ushort const_value_index;
}

[...]

https://gist.github.com/run-dlang/5dd783c750f04329405af1b1e4a83cde

Here's the full source

May 30, 2023

On Tuesday, 30 May 2023 at 08:42:38 UTC, Gimbles wrote:

>

My code is this
[...]
Should I make an issue for this as it suggests?

100% yes. This an "Internal Compiler Error" (ICE), meaning the compiler has crashed.
Open a ticket here : https://issues.dlang.org/show_bug.cgi?id=23935

with a title like "ICE caused by std.sumtype", and paste the test case.

May 30, 2023

On Tuesday, 30 May 2023 at 08:47:16 UTC, user456 wrote:

>

On Tuesday, 30 May 2023 at 08:42:38 UTC, Gimbles wrote:

>

My code is this
[...]
Should I make an issue for this as it suggests?

100% yes. This an "Internal Compiler Error" (ICE), meaning the compiler has crashed.
Open a ticket here : https://issues.dlang.org/show_bug.cgi?id=23935

with a title like "ICE caused by std.sumtype", and paste the test case.

Alright, thanks! Opening a ticket :)

May 30, 2023

On Tuesday, 30 May 2023 at 08:54:33 UTC, Gimbles wrote:

>

On Tuesday, 30 May 2023 at 08:47:16 UTC, user456 wrote:

>

On Tuesday, 30 May 2023 at 08:42:38 UTC, Gimbles wrote:

>

My code is this
[...]
Should I make an issue for this as it suggests?

100% yes. This an "Internal Compiler Error" (ICE), meaning the compiler has crashed.
Open a ticket here : https://issues.dlang.org/show_bug.cgi?id=23935

with a title like "ICE caused by std.sumtype", and paste the test case.

Alright, thanks! Opening a ticket :)

https://issues.dlang.org/show_bug.cgi?id=23945

For reference ^^^