Title
default_delete<T[]>::operator() should only accept T*
Status
c++11
Section
[unique.ptr.dltr.dflt1]
Submitter
Howard Hinnant

Created on 2008-12-07.00:00:00 last changed 162 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Add to [unique.ptr.dltr.dflt1]:

namespace std {
  template <class T> struct default_delete<T[]> {
    void operator()(T*) const;
  template <class U> void operator()(U*) const = delete;
};
}
Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

We agree with the proposed resolution. Move to Tentatively Ready.

Date: 2010-10-21.18:28:33

[ Post Summit: ]

Recommend Review.

Date: 2008-12-07.00:00:00

Consider:

derived* p = new derived[3];
std::default_delete<base[]> d;
d(p);  // should fail

Currently the marked line is a run time failure. We can make it a compile time failure by "poisoning" op(U*).

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg4460
2010-10-21 18:28:33adminsetmessages: + msg4459
2010-10-21 18:28:33adminsetmessages: + msg4458
2008-12-07 00:00:00admincreate