Skip to content

Move/copy ctor and destructor do not run on std::vector reallocation #587

Open

Description

@lucic71

When a std::vector reallocates the move constructor (or copy constructor is move is not marked noexcept) is called. The destructor is also called on the old elements.

Our Vec<T> translation does not respect that.

Activity

  1. lucic71 commented on Nov 4, 2026

    @lucic71
    ContributorAuthor

    For triviallly copyable types this is a no-op because they do bitwise copy. This affects types with custom move/copy constructors and destructors.

  2. lucic71 commented on Nov 20, 2026

    @lucic71
    ContributorAuthor

    Same for vector::erase: shift elements with move assignment and destroy the element

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions