Title
There is no such thing as an Exception Safety element
Status
c++17
Section
[util.smartptr.shared.const]
Submitter
Jonathan Wakely

Created on 2015-05-05.00:00:00 last changed 81 months ago

Messages

Date: 2015-08-03.14:55:12

Proposed resolution:

This wording is relative to N4431.

  1. Change [util.smartptr.shared.const] as follows:

    template<class Y> explicit shared_ptr(Y* p);
    

    […]

    -4- Effects: Constructs a shared_ptr object that owns the pointer p. If an exception is thrown, delete p is called.

    […]

    -7- Exception safety: If an exception is thrown, delete p is called.

    template <class Y, class D> shared_ptr(Y* p, D d);
    template <class Y, class D, class A> shared_ptr(Y* p, D d, A a);
    template <class D> shared_ptr(nullptr_t p, D d);
    template <class D, class A> shared_ptr(nullptr_t p, D d, A a);
    

    […]

    -9- Effects: Constructs a shared_ptr object that owns the object p and the deleter d. The second and fourth constructors shall use a copy of a to allocate memory for internal use. If an exception is thrown, d(p) is called.

    […]

    -12- Exception safety: If an exception is thrown, d(p) is called.

    […]
    template <class Y> explicit shared_ptr(const weak_ptr<Y>& r);
    

    […]

    -24- Effects: Constructs a shared_ptr object that shares ownership with r and stores a copy of the pointer stored in r. If an exception is thrown, the constructor has no effect.

    […]

    -27- Exception safety: If an exception is thrown, the constructor has no effect.

    template <class Y, class D> shared_ptr(unique_ptr<Y, D>&& r);
    

    […]

    -29- Effects: Equivalent to shared_ptr(r.release(), r.get_deleter()) when D is not a reference type, otherwise shared_ptr(r.release(), ref(r.get_deleter())). If an exception is thrown, the constructor has no effect.

    -30- Exception safety: If an exception is thrown, the constructor has no effect.

Date: 2017-02-02.00:41:18

[ 2015-06, Telecon ]

Move to Tentatively Ready.

Date: 2015-05-05.00:00:00

[util.smartptr.shared.const] includes several "Exception safety" elements, but that is not one of the elements defined in 17.5.1.4 [structure.specifications]. We should either define what it means, or just move those sentences into the Effects: clause.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2015-10-27 16:52:45adminsetstatus: ready -> wp
2015-08-03 14:55:12adminsetmessages: + msg7483
2015-08-03 14:55:12adminsetstatus: new -> ready
2015-05-20 18:40:13adminsetmessages: + msg7411
2015-05-05 00:00:00admincreate