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

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

Priority: Not Prioritized

View all issues with C++11 status.



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 [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;