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; };
I'm handling this one too.
Author: paolo Date: Sat Apr 16 02:02:29 2011 New Revision: 172534 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172534 Log: 2011-04-15 Daniel Krugler <daniel.kruegler@googlemail.com> Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/48631 * include/bits/unique_ptr.h (default_delete<_Tp[]>): Add deleted function call operator. * testsuite/20_util/default_delete/48631_neg.cc: New. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-error line numbers. Added: trunk/libstdc++-v3/testsuite/20_util/default_delete/48631_neg.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/unique_ptr.h trunk/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
Author: paolo Date: Sat Apr 16 02:04:56 2011 New Revision: 172535 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172535 Log: 2011-04-15 Daniel Krugler <daniel.kruegler@googlemail.com> Paolo Carlini <paolo.carlini@oracle.com> PR libstdc++/48631 * include/bits/unique_ptr.h (default_delete<_Tp[]>): Add deleted function call operator. * testsuite/20_util/default_delete/48631_neg.cc: New. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-error line numbers. Added: branches/gcc-4_6-branch/libstdc++-v3/testsuite/20_util/default_delete/48631_neg.cc Modified: branches/gcc-4_6-branch/libstdc++-v3/ChangeLog branches/gcc-4_6-branch/libstdc++-v3/include/bits/unique_ptr.h branches/gcc-4_6-branch/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
Done. Fixed mainline and 4_6-branch.
Jason, in case the issue is not known and your are interested: after the library fix we reject the snippet but we give the error message twice.