OSDN Git Service

2010-11-10 Jonathan Wakely <jwakely.gcc@gmail.com>
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Nov 2010 10:09:03 +0000 (10:09 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Nov 2010 10:09:03 +0000 (10:09 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166525 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/unique_ptr.h
libstdc++-v3/testsuite/20_util/unique_ptr/cons/ptr_deleter_neg.cc
libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc

index 51cf2eb..ab60cb3 100644 (file)
@@ -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>
 
        * 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.
index ff1a925..7436798 100644 (file)
@@ -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)
index 143578e..e765874 100644 (file)
@@ -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" }
 }
index 4e46c90..f0a1f6c 100644 (file)
@@ -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 }