See dlang forum thread: https://forum.dlang.org/post/yiruzleiblljendduqmu@forum.dlang.org Source: https://gist.github.com/run-dlang/5dd783c750f04329405af1b1e4a83cde ```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. ```
Maybe reduction: struct SumType() { ArrayValue value; this(ArrayValue value) { this.value = value; } static if (__traits(compiles, hashOf(ElementValuePair.init))) { size_t toHash() { return 0; } } } struct ArrayValue { ElementValue[] values; } struct ElementValuePair { ElementValue element_value; } alias ElementValue = SumType!(); ==== Error: unknown, please file report on issues.dlang.org I suspect something with hashOf and struct initialization order. I think this may have been a few steps minified too far, but it's still spitting out "Error: unknown", so...
As a workaround, sticking this code into AnnotationValue in the original code: size_t toHash() const { return hashOf(annotation_value); } also makes it compile. I think because the hashOf is hidden in a method body, the sema doesn't have to recurse immediately from AnnotationValue into Annotation, which breaks the loop.