Skip to content

LWG3476: thread and jthread constructors require that the parameters be move-constructible but never move construct the parameters #104307

Description

@ldionne

Activity

  1. added
    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
    lwg-issueCanonical version of a Library Working Group issue.
    on Aug 14, 2024
  2. mleleszi commented on Dec 21, 2025

    @mleleszi
    Member

    Hey @ldionne, I wanna have a go at this. Looks like jthread already has the correct mandates, but thread and async are missing all of them so need to add them there.

  3. self-assigned this
    on Dec 21, 2025
  4. frederick-vs-ja commented on Dec 22, 2025

    @frederick-vs-ja
    Contributor

    Thanks @mleleszi!

    I have some thoughts:

    1. For all of async, jthread, and thread, we should add test cases.
    2. For thread, I think these Mandates are already implicitly imposed by using tuple.
    3. For async, I believe we need to refactor internal functions to perfect-forward arguments wherever needed.

    Such a class can be used. In tests, we can use a cv-unqualified test_class lvalue as an argument.

    struct test_class {
      test_class()                  = default;
      test_class(test_class&)       = default;
      test_class(const test_class&) = delete;
    };
  5. mleleszi commented on Dec 22, 2025

    @mleleszi
    Member

    Thanks for the pointers!

    For thread, would it still be worth adding the mandates explicitly? Or you usually don't do that if they're implicitly imposed.

  6. frederick-vs-ja commented on Dec 22, 2025

    @frederick-vs-ja
    Contributor

    I think additional explicit static_assert would be a bit useful, as the error messages from tuple constructors are usually messy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

c++23libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.lwg-issueCanonical version of a Library Working Group issue.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions