unique_ptr.h (default_delete<>::default_delete()): Declare defaulted per DR 1517.

2011-01-18  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/unique_ptr.h (default_delete<>::default_delete()):
	Declare defaulted per DR 1517.
	* testsuite/util/testsuite_common_types.h
	(constexpr_defaulted_default_constructible): Add.
	* testsuite/20_util/default_delete/cons/constexpr.cc: Use it.

From-SVN: r168947
This commit is contained in:
Paolo Carlini 2011-01-18 11:12:06 +00:00 committed by Paolo Carlini
parent e7ef91dc8e
commit d326f2eeb7
4 changed files with 30 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2011-01-18 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/unique_ptr.h (default_delete<>::default_delete()):
Declare defaulted per DR 1517.
* testsuite/util/testsuite_common_types.h
(constexpr_defaulted_default_constructible): Add.
* testsuite/20_util/default_delete/cons/constexpr.cc: Use it.
2011-01-17 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_queue.h (queue<>::swap, priority_queue<>::swap):

View File

@ -47,7 +47,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp>
struct default_delete
{
constexpr default_delete() { }
constexpr default_delete() = default;
template<typename _Up, typename = typename
std::enable_if<std::is_convertible<_Up*, _Tp*>::value>::type>
@ -68,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp>
struct default_delete<_Tp[]>
{
constexpr default_delete() { }
constexpr default_delete() = default;
void
operator()(_Tp* __ptr) const

View File

@ -23,7 +23,7 @@
int main()
{
__gnu_test::constexpr_default_constructible test;
__gnu_test::constexpr_defaulted_default_constructible test;
test.operator()<std::default_delete<int>>();
return 0;
}

View File

@ -644,7 +644,7 @@ namespace __gnu_test
template<typename _Tp, bool _IsLitp = std::is_literal_type<_Tp>::value>
struct _Concept;
// NB: _Tp must be a literal type.
// NB: _Tp must be a literal type.
// Have to have user-defined default ctor for this to work.
template<typename _Tp>
struct _Concept<_Tp, true>
@ -671,6 +671,24 @@ namespace __gnu_test
}
};
// Generator to test defaulted default constructor.
struct constexpr_defaulted_default_constructible
{
template<typename _Tp>
void
operator()()
{
struct _Concept
{
void __constraint()
{ constexpr _Tp __v __attribute__((unused)) { }; }
};
void (_Concept::*__x)() __attribute__((unused))
= &_Concept::__constraint;
}
};
struct constexpr_single_value_constructible
{
template<typename _Ttesttype, typename _Tvaluetype,