Title
Underspecified destruction of objects created in std::make_shared_for_overwrite/std::allocate_shared_for_overwrite
Status
wp
Section
[util.smartptr.shared.create]
Submitter
Jiang An

Created on 2023-12-16.00:00:00 last changed 3 weeks ago

Messages

Date: 2024-11-28.21:40:31

Proposed resolution:

This wording is relative to N4964.

  1. Modify [util.smartptr.shared.create] as indicated:

    template<class T, ...>
      shared_ptr<T> make_shared(args);
    template<class T, class A, ...>
      shared_ptr<T> allocate_shared(const A& a, args);
    template<class T, ...>
      shared_ptr<T> make_shared_for_overwrite(args);
    template<class T, class A, ...>
      shared_ptr<T> allocate_shared_for_overwrite(const A& a, args);
    

    […]

    -7- Remarks:

    1. […]

    2. (7.11) — When a (sub)object of non-array type U that was initialized by make_shared, make_shared_for_overwrite, or allocate_shared_for_overwrite is to be destroyed, it is destroyed via the expression pv->~U() where pv points to that object of type U.

    3. […]

Date: 2024-11-28.21:40:31

[ Wrocław 2024-11-23; Status changed: Voting → WP. ]

Date: 2024-08-15.00:00:00

[ 2024-08-21; Move to Ready at LWG telecon ]

Date: 2024-03-15.00:00:00

[ 2024-03-11; Reflector poll ]

Set priority to 2 after reflector poll in December 2023.

This was the P1020R1 author's intent (see LWG reflector mail in November 2018) but it was never clarified in the wording. This fixes that.

Date: 2023-12-16.00:00:00

Currently, only destructions of non-array (sub)objects created in std::make_shared and std::allocate_shared are specified in [util.smartptr.shared.create]. Presumably, objects created in std::make_shared_for_overwrite and std::allocate_shared_for_overwrite should be destroyed by plain destructor calls.

History
Date User Action Args
2024-11-28 21:40:31adminsetmessages: + msg14474
2024-11-28 21:40:31adminsetstatus: voting -> wp
2024-11-19 16:09:07adminsetstatus: ready -> voting
2024-08-21 17:27:04adminsetmessages: + msg14336
2024-08-21 17:27:04adminsetstatus: new -> ready
2024-03-11 22:16:42adminsetmessages: + msg13990
2023-12-16 14:01:33adminsetmessages: + msg13890
2023-12-16 00:00:00admincreate