Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bogus unique_ptr-to-shared_ptr conversions should be forbidden #53368

Closed
CaseyCarter opened this issue Jan 23, 2022 · 3 comments
Closed

Bogus unique_ptr-to-shared_ptr conversions should be forbidden #53368

CaseyCarter opened this issue Jan 23, 2022 · 3 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@CaseyCarter
Copy link
Member

Every converting construction/assignment from unique_ptr to shared_ptr in https://godbolt.org/z/drYoErG6v should fail. The problematic cases are:

  • construction/assignment to shared_ptr<T> from unique_ptr<T[]>, and
  • construction/assignment to shared_ptr<base[]> from unique_ptr<derived[]>
    both of which fail the "Y* is compatible with T*" constraint.

(Related: https://reviews.llvm.org/D117996)

@CaseyCarter CaseyCarter added bug Indicates an unexpected problem or unintended behavior libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. labels Jan 23, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 23, 2022

@llvm/issue-subscribers-bug

@Quuxplusone
Copy link
Contributor

Should probably fix https://wg21.link/LWG3548 "deleters should be moved, not copied" at the same time.

@huixie90 huixie90 self-assigned this Feb 5, 2023
@huixie90
Copy link
Contributor

should be fixed already by
a38a465

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

4 participants