Index: include/bits/unique_ptr.h =================================================================== --- include/bits/unique_ptr.h (revision 166515) +++ include/bits/unique_ptr.h (working copy) @@ -109,7 +109,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Constructors. constexpr unique_ptr() : _M_t() - { } + { static_assert(!std::is_pointer::value, + "constructed with null function pointer deleter"); } explicit unique_ptr(pointer __p) @@ -130,7 +131,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) constexpr unique_ptr(nullptr_t) : _M_t() - { } + { static_assert(!std::is_pointer::value, + "constructed with null function pointer deleter"); } // Move constructors. unique_ptr(unique_ptr&& __u) @@ -269,7 +271,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Constructors. constexpr unique_ptr() : _M_t() - { } + { static_assert(!std::is_pointer::value, + "constructed with null function pointer deleter"); } explicit unique_ptr(pointer __p) @@ -288,10 +291,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { static_assert(!std::is_reference::value, "rvalue deleter bound to reference"); } - /* TODO: use delegating constructor */ constexpr unique_ptr(nullptr_t) : _M_t() - { } + { static_assert(!std::is_pointer::value, + "constructed with null function pointer deleter"); } // Move constructors. unique_ptr(unique_ptr&& __u) Index: testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc =================================================================== --- testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc (revision 166515) +++ testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc (working copy) @@ -30,9 +30,9 @@ using std::unique_ptr; void test01() { - unique_ptr p1; // { dg-error "here" "" { xfail *-*-* } } + unique_ptr p1; // { dg-error "here" } - unique_ptr p2(nullptr); // { dg-error "here" "" { xfail *-*-* } } + unique_ptr p2(nullptr); // { dg-error "here" } unique_ptr p3(new int); // { dg-error "here" } } @@ -40,9 +40,9 @@ test01() void test02() { - unique_ptr p1; // { dg-error "here" "" { xfail *-*-* } } + unique_ptr p1; // { dg-error "here" } - unique_ptr p2(nullptr); // { dg-error "here" "" { xfail *-*-* } } + unique_ptr p2(nullptr); // { dg-error "here" } unique_ptr p3(new int[1]); // { dg-error "here" } } Index: testsuite/20_util/weak_ptr/comparison/cmp_neg.cc =================================================================== --- testsuite/20_util/weak_ptr/comparison/cmp_neg.cc (revision 166515) +++ testsuite/20_util/weak_ptr/comparison/cmp_neg.cc (working copy) @@ -43,7 +43,7 @@ main() // { dg-warning "note" "" { target *-*-* } 350 } // { dg-warning "note" "" { target *-*-* } 1082 } -// { dg-warning "note" "" { target *-*-* } 462 } +// { dg-warning "note" "" { target *-*-* } 465 } // { dg-warning "note" "" { target *-*-* } 580 } // { dg-warning "note" "" { target *-*-* } 1027 } // { dg-warning "note" "" { target *-*-* } 340 }