This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/48631] New: [C++0x] default_delete<T[]> accepts pointer conversions in function call operator


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48631

           Summary: [C++0x] default_delete<T[]> accepts pointer
                    conversions in function call operator
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


The following program using 4.7.0 20110409 (experimental) should be rejected,
but is accepted:

//------------
#include <memory>

struct B {};
struct D : B {};

int main() {
  D d;
  std::default_delete<B[]> db;
  typedef decltype(db(&d)) type;
}
//------------

Reason for this deviation of the spec is the missing deleted function call
operator as described in [unique.ptr.dltr.dflt1]:

template <class T> struct default_delete<T[]> {
  constexpr default_delete() noexcept = default;
  void operator()(T*) const;
  template <class U> void operator()(U*) const = delete;
};


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]