SumType! seemingly results in cryptic error, with dub suggesting to make an issue ticket
Gimbles
yusharora at protonmail.com
Tue May 30 08:42:38 UTC 2023
My code is this
```d
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
```d
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?
More information about the Digitalmars-d-learn
mailing list