Bug 20426 – doesPointTo with void[N] fails

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-12-02T19:40:33Z
Last change time
2020-04-26T18:43:31Z
Keywords
pull
Assigned to
No Owner
Creator
Steven Schveighoffer

Comments

Comment #0 by schveiguy — 2019-12-02T19:40:33Z
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.
Comment #1 by dlang-bot — 2020-04-26T00:06:40Z
@MoonlightSentinel created dlang/phobos pull request #7458 "Fix Issue 20426 - doesPointTo with void[N] fails" fixing this issue: - Fix Issue 20426 - doesPointTo with void[N] fails Accept a false positive/negative for may/doesPointTo https://github.com/dlang/phobos/pull/7458
Comment #2 by dlang-bot — 2020-04-26T18:43:31Z
dlang/phobos pull request #7458 "Fix Issue 20426 - doesPointTo with void[N] fails" was merged into master: - bf7bde11cce9327a6cfa71be1f96386f97d0ff1e by MoonlightSentinel: Fix Issue 20426 - doesPointTo with void[N] fails Accept a false positive/negative for may/doesPointTo https://github.com/dlang/phobos/pull/7458