diff options
| -rw-r--r-- | libstdc++-v3/ChangeLog | 15 | ||||
| -rw-r--r-- | libstdc++-v3/include/bits/unique_ptr.h | 13 | ||||
| -rw-r--r-- | libstdc++-v3/testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc | 8 | ||||
| -rw-r--r-- | libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc | 2 |
4 files changed, 28 insertions, 10 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 51cf2eb..ab60cb3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2010-11-10 Jonathan Wakely <jwakely.gcc@gmail.com> + + * include/bits/unique_ptr.h: Use static_assert in constexpr + constructors. + * testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc: Remove xfails. + * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-error + line number. + 2010-11-09 François Dumont <francois.cppdevs@free.fr> Johannes Singler <singler@kit.edu> @@ -15,6 +23,13 @@ * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-error line number. +2010-11-08 Jonathan Wakely <jwakely.gcc@gmail.com> + + * include/bits/unique_ptr.h: Move misplaced static_assert and use + tuple's constexpr constructor in constexpr constructors. + * testsuite/20_util/unique_ptr/cons/ptr_deleter.cc: New. + * testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc: New. + 2010-11-08 Benjamin Kosnik <bkoz@redhat.com> * doc/doxygen/user.cfg.in: Adjust scanned includes. diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index ff1a925..7436798 100644 --- a/libstdc++-v3/include/bits/unique_ptr.h +++ b/libstdc++-v3/include/bits/unique_ptr.h @@ -109,7 +109,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Constructors. constexpr unique_ptr() : _M_t() - { } + { static_assert(!std::is_pointer<deleter_type>::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<deleter_type>::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<deleter_type>::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<deleter_type>::value, "rvalue deleter bound to reference"); } - /* TODO: use delegating constructor */ constexpr unique_ptr(nullptr_t) : _M_t() - { } + { static_assert(!std::is_pointer<deleter_type>::value, + "constructed with null function pointer deleter"); } // Move constructors. unique_ptr(unique_ptr&& __u) diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc index 143578e..e765874 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc @@ -30,9 +30,9 @@ using std::unique_ptr; void test01() { - unique_ptr<int, void(*)(int*)> p1; // { dg-error "here" "" { xfail *-*-* } } + unique_ptr<int, void(*)(int*)> p1; // { dg-error "here" } - unique_ptr<int, void(*)(int*)> p2(nullptr); // { dg-error "here" "" { xfail *-*-* } } + unique_ptr<int, void(*)(int*)> p2(nullptr); // { dg-error "here" } unique_ptr<int, void(*)(int*)> p3(new int); // { dg-error "here" } } @@ -40,9 +40,9 @@ test01() void test02() { - unique_ptr<int[], void(*)(int*)> p1; // { dg-error "here" "" { xfail *-*-* } } + unique_ptr<int[], void(*)(int*)> p1; // { dg-error "here" } - unique_ptr<int[], void(*)(int*)> p2(nullptr); // { dg-error "here" "" { xfail *-*-* } } + unique_ptr<int[], void(*)(int*)> p2(nullptr); // { dg-error "here" } unique_ptr<int[], void(*)(int*)> p3(new int[1]); // { dg-error "here" } } diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc index 4e46c90..f0a1f6c 100644 --- a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc @@ -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 } |
