Skip to content

[REG 2.106] Allocating an array of type void[] is marked as not containing pointers #22517

Closed

Description

@schveiguy
void main()
{
    import core.memory, std.stdio;
    auto arr = new void[10];
    writeln(GC.getAttr(arr.ptr) & GC.BlkAttr.NO_SCAN);
}

Prior to 2.106, this prints 0, since then it prints 2. void[] arrays should be considered as containing pointers.

The issue was introduced with #15299

The problem is that T of T[] is used to determine whether it has indirections, but void has no indirections. Perhaps a special case for void here.

cc @teodutu

Activity

  1. schveiguy commented on Feb 5, 2026

    @schveiguy
    MemberAuthor

    Further thoughts:

    TypeInfo_v (typeid(void)) is marked as "contains pointers", for this reason. I'm unsure whether the correct fix is to add a special case for void in the array alloc function, or change hasIndirections implementation for void. Since void variable/field cannot be declared except as an array type, would fixing hasIndirections!void to true make things cleaner everywhere? This mistake was made here, it could be made elsewhere.

  2. kinke commented on Feb 5, 2026

    @kinke
    Contributor

    Yeah I think it would probably make sense to make hasIndirections!void true, with a fat note in its documentation. hasIndirections!(void[1]) is already true, and that's probably the only case where a (non-empty) static-array differs wrt. hasIndirections from its element type.

  3. added
    Severity:Regression
    on Feb 6, 2026
  4. added a commit that references this issue on Feb 19, 2026
  5. added a commit that references this issue on Feb 20, 2026
  6. schveiguy commented on Feb 23, 2026

    @schveiguy
    MemberAuthor

    Not sure why this didn't auto close...

  7. kinke commented on Feb 23, 2026

    @kinke
    Contributor

    AFAIK, the issues are only closed automatically once the fix is in master, so requiring a back-merge from stable to master.

    Edit: Oh, the PR targeted master. Maybe the 'fix issue …' isn't understood, needing 'fix …'?
    Edit2: Seems so: https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

  8. added a commit that references this issue on Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Severity:Regression

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions