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

P2413 Remove unsafe conversions of unique_ptr #1083

Closed
wg21bot opened this issue Jul 30, 2021 · 2 comments
Closed

P2413 Remove unsafe conversions of unique_ptr #1083

wg21bot opened this issue Jul 30, 2021 · 2 comments
Labels
B2 - improvement Bucket 2 as described by P0592: bug fixes, performance improvements, integration fixes for/between e IS Ship vehicle: IS LEWG Library Evolution needs-revision Paper needs changes before it can proceed size - small paper size estimate

Comments

@wg21bot
Copy link
Collaborator

wg21bot commented Jul 30, 2021

P2413R0 Remove unsafe conversions of unique_ptr (Lénárd Szolnoki)

@wg21bot wg21bot added the LEWGI Library Evolution Incubator label Jul 30, 2021
@wg21bot wg21bot added this to the 2021-telecon milestone Jul 30, 2021
@cor3ntin cor3ntin added LEWG Library Evolution ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list and removed LEWGI Library Evolution Incubator labels Jul 31, 2021
@brycelelbach brycelelbach added B2 - improvement Bucket 2 as described by P0592: bug fixes, performance improvements, integration fixes for/between e IS Ship vehicle: IS size - small paper size estimate labels Aug 1, 2021
@cor3ntin cor3ntin added the needs-revision Paper needs changes before it can proceed label Sep 13, 2021
@cor3ntin
Copy link

cor3ntin commented Sep 13, 2021

Mailing list review 2021-08-16 to 2021-09-13

Some interest to provide the fix proposed by the paper.
But several people also suggested to apply a similar constraint to the pointer constructor/assignment operators/reset, or at the very least to see that explored in the paper.

Do we need a "destroying delete type trait"? The breaking changes proposed in the paper are somewhat serious and impact sensible code.

The following suggestion was provided to constrain the pointer-taking methods. One downside is that it would have false negative for incomplete types.

template<typename U>
        requires (__is_default_delete<D>::value)
        && (!same_as<const volatile U, const volatile T>)
        && is_convertible_v<U*, T*>
        && (!has_virtual_destructor_v<T>)
        unique_ptr(U*) = delete;

However we observed that the proposed design has similar issues as regard to incomplete types and we encourage the author to mention these breaking change in the next revision.

Suggestion

  • Explore constraining the pointer construction functions as suggested, in addition of the default_deleter
  • Explore a has_destroying_delete type trait
  • Come back for a second round of mailing list review with these changes, or motivation against making them

@jensmaurer jensmaurer removed this from the 2021-telecon milestone Nov 12, 2021
@brycelelbach brycelelbach removed the ready-for-library-evolution-mailing-list-review This paper needs to be discussed on the Library Evolution mailing list label May 24, 2023
@cplusplus cplusplus deleted a comment from JohelEGP May 24, 2023
@brycelelbach
Copy link

Closing due to more than 1 year of inactivity. Please re-open if further work is expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B2 - improvement Bucket 2 as described by P0592: bug fixes, performance improvements, integration fixes for/between e IS Ship vehicle: IS LEWG Library Evolution needs-revision Paper needs changes before it can proceed size - small paper size estimate
Projects
None yet
Development

No branches or pull requests

4 participants