cplusplus / papers

ISO/IEC JTC1 SC22 WG21 paper scheduling and management
636 stars 18 forks source link

P2413 R1 Remove unsafe conversions of unique_ptr<T> #1083

Open wg21bot opened 3 years ago

wg21bot commented 3 years ago

P2413R0 Remove unsafe conversions of unique_ptr\<T> (Lénárd Szolnoki)

cor3ntin commented 3 years ago

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

brycelelbach commented 1 year ago

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

wg21bot commented 4 months ago

P2413R1 Remove unsafe conversions of unique_ptr\<T> (Lénárd Szolnoki)

ben-craig commented 3 months ago

2024-06-27 Library Evolution St. Louis Meeting

P2413R1: Remove unsafe conversions of unique_ptr\<T>

2024-06-27 Library Evolution St. Louis Minutes

Champion: Lenard Szolnoki

Chair: Ben Craig & Fabio Fracassi

Minute Taker: Marc Hoemmen

Summary

POLL: The increased checking provided by P2413R1 is worth the known breaking changes and build time throughput costs

SF WF N WA SA
1 2 6 5 3

Attendance: 16 in person, 7 remote

# of Authors: 1

Author Position: SF

Outcome: No consensus to proceed

Comments:

Next Steps

Recommend reconsidering R0 solution.