digitalmars.D.bugs - [Issue 20426] New: doesPointTo with void[N] fails
- d-bugmail puremagic.com (29/29) Dec 02 2019 https://issues.dlang.org/show_bug.cgi?id=20426
https://issues.dlang.org/show_bug.cgi?id=20426 Issue ID: 20426 Summary: doesPointTo with void[N] fails Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: schveiguy yahoo.com void[16] n = void; assert(!doesPointTo(n, n)); gives errors: /dlang/dmd/linux/bin64/../../src/phobos/std/exception.d(1149): Error: variable std.exception.doesPointTo!(void[16], void[16], void).doesPointTo.s variables cannot be of type void /dlang/dmd/linux/bin64/../../src/phobos/std/exception.d(1149): Error: expression __r6[__key7] is void and has no value void[N] technique is a way to provide space for untyped data. doesPointTo should just ignore it (it's OK for doesPointTo to have false negatives). The issue is in the handling of static arrays, it foreaches over the elements and recurses. Of course, there is no element type. I think the correct fix is simply to return false for void[N]. The end result of not supporting this is that you can't sort types that contain these items, even if you don't use the void array in the comparison. --
Dec 02 2019