D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20426 - doesPointTo with void[N] fails
Summary: doesPointTo with void[N] fails
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2019-12-02 19:40 UTC by Steven Schveighoffer
Modified: 2020-04-26 18:43 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Steven Schveighoffer 2019-12-02 19:40:33 UTC
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 Dlang Bot 2020-04-26 00:06:40 UTC
@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 Dlang Bot 2020-04-26 18:43:31 UTC
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