This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/48631] New: [C++0x] default_delete<T[]> accepts pointer conversions in function call operator
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 15 Apr 2011 19:55:54 +0000
- Subject: [Bug libstdc++/48631] New: [C++0x] default_delete<T[]> accepts pointer conversions in function call operator
- Auto-submitted: auto-generated
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;
};