This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

938. default_delete<T[]>::operator() should only accept T*

Section: 20.3.1.2.3 [unique.ptr.dltr.dflt1] Status: C++11 Submitter: Howard Hinnant Opened: 2008-12-07 Last modified: 2016-01-28

Priority: Not Prioritized

View all issues with C++11 status.

Discussion:

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*).

[ Post Summit: ]

Recommend Review.

[ Batavia (2009-05): ]

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

Proposed resolution:

Add to 20.3.1.2.3 [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;
};
}