Add missing variable traits, fix testsuite failures.

* include/bits/uses_allocator.h (uses_allocator_v): New.
	* include/std/functional (is_bind_expression_v, is_placeholder_v):
	Likewise.
	* testsuite/20_util/bind/is_placeholder_v.cc: Likewise.
	* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
	* testsuite/20_util/duration/literals/range.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.
	* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.
	* testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc:
	New.

From-SVN: r238921
This commit is contained in:
Ville Voutilainen 2016-07-31 17:52:53 +03:00 committed by Ville Voutilainen
parent 589584612f
commit 8c9142276b
13 changed files with 105 additions and 9 deletions

View File

@ -1,3 +1,22 @@
2016-07-31 Ville Voutilainen <ville.voutilainen@gmail.com>
Add missing variable traits, fix testsuite failures.
* include/bits/uses_allocator.h (uses_allocator_v): New.
* include/std/functional (is_bind_expression_v, is_placeholder_v):
Likewise.
* testsuite/20_util/bind/is_placeholder_v.cc: Likewise.
* testsuite/20_util/declval/requirements/1_neg.cc: Adjust.
* testsuite/20_util/duration/literals/range.cc: Likewise.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
Likewise.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.
* testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc:
New.
2016-07-31 Jonathan Wakely <jwakely@redhat.com>
* testsuite/18_support/numeric_limits/40856.cc [__STRICT_ANSI__]: Do

View File

@ -108,6 +108,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__ret._M_a = std::__addressof(__a);
return __ret;
}
#if __cplusplus > 201402L
template <typename _Tp, typename _Alloc>
constexpr bool uses_allocator_v = uses_allocator<_Tp, _Alloc>::value;
#endif // C++17
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std

View File

@ -682,6 +682,13 @@ _GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type)
: public integral_constant<int, 0>
{ };
#if __cplusplus > 201402L
template <typename _Tp> constexpr bool is_bind_expression_v
= is_bind_expression<_Tp>::value;
template <typename _Tp> constexpr int is_placeholder_v
= is_placeholder<_Tp>::value;
#endif // C++17
/** @brief The type of placeholder objects defined by libstdc++.
* @ingroup binders
*/

View File

@ -0,0 +1,37 @@
// { dg-options "-std=gnu++17" }
// { dg-do compile }
// Copyright (C) 2016 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a moved_to of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <functional>
struct X
{
int operator()() const { return 0; }
int operator()() volatile { return 1; }
int operator()() const volatile { return 2; }
void operator()() { };
};
static_assert( std::is_placeholder<decltype(std::placeholders::_1)>::value
== std::is_placeholder_v<decltype(std::placeholders::_1)>);
const auto b0 = std::bind(X());
static_assert( std::is_bind_expression<decltype(b0)>::value
== std::is_bind_expression_v<decltype(b0)>);

View File

@ -19,7 +19,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// { dg-error "static assertion failed" "" { target *-*-* } 2259 }
// { dg-error "static assertion failed" "" { target *-*-* } 2272 }
#include <utility>

View File

@ -27,5 +27,5 @@ test01()
// std::numeric_limits<int64_t>::max() == 9223372036854775807;
auto h = 9223372036854775808h;
// { dg-error "cannot be represented" "" { target *-*-* } 796 }
// { dg-error "cannot be represented" "" { target *-*-* } 800 }
}

View File

@ -31,5 +31,5 @@ void test01()
test_type d;
}
// { dg-error "rep cannot be a duration" "" { target *-*-* } 246 }
// { dg-error "rep cannot be a duration" "" { target *-*-* } 250 }
// { dg-error "required from here" "" { target *-*-* } 31 }

View File

@ -32,5 +32,5 @@ void test01()
test_type d; // { dg-error "required from here" }
}
// { dg-error "must be a specialization of ratio" "" { target *-*-* } 247 }
// { dg-error "must be a specialization of ratio" "" { target *-*-* } 251 }
// { dg-prune-output "not a member" }

View File

@ -33,5 +33,5 @@ void test01()
test_type d;
}
// { dg-error "period must be positive" "" { target *-*-* } 249 }
// { dg-error "period must be positive" "" { target *-*-* } 253 }
// { dg-error "required from here" "" { target *-*-* } 33 }

View File

@ -48,4 +48,4 @@ void test01()
// { dg-error "required from here" "" { target *-*-* } 40 }
// { dg-error "required from here" "" { target *-*-* } 42 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1924 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1937 }

View File

@ -48,5 +48,5 @@ void test01()
// { dg-error "required from here" "" { target *-*-* } 40 }
// { dg-error "required from here" "" { target *-*-* } 42 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1820 }
// { dg-error "declaration of" "" { target *-*-* } 1777 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1833 }
// { dg-error "declaration of" "" { target *-*-* } 1790 }

View File

@ -42,7 +42,7 @@ test02()
// { dg-error "required from here" "" { target *-*-* } 29 }
// { dg-error "expected initializer" "" { target *-*-* } 36 }
// { dg-error "expected initializer" "" { target *-*-* } 38 }
// { dg-error "overflow in addition" "" { target *-*-* } 435 }
// { dg-error "overflow in addition" "" { target *-*-* } 451 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 97 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 99 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 101 }

View File

@ -0,0 +1,29 @@
// { dg-options "-std=gnu++17" }
// { dg-do compile }
// Copyright (C) 2016 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a moved_to of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <memory>
#include <string>
using namespace std;
static_assert(uses_allocator<int, allocator<int>>::value
== uses_allocator_v<int, allocator<int>>);
static_assert(uses_allocator<string, allocator<string>>::value
== uses_allocator_v<string, allocator<string>>);