Commit ef40b371 by Jonathan Wakely Committed by Jonathan Wakely

unique_ptr.h: Use static_assert in constexpr constructors.

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.

From-SVN: r166525
parent c6dfaad5
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.
......
......@@ -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)
......
......@@ -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" }
}
......
......@@ -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 }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment