aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/20_util
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/20_util')
-rw-r--r--libstdc++-v3/testsuite/20_util/as_const/1.cc30
-rw-r--r--libstdc++-v3/testsuite/20_util/as_const/rvalue_neg.cc28
-rw-r--r--libstdc++-v3/testsuite/20_util/bind/is_placeholder_v.cc37
-rw-r--r--libstdc++-v3/testsuite/20_util/conditional/requirements/typedefs.cc24
-rw-r--r--libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/literals/range.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc33
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc5
-rw-r--r--libstdc++-v3/testsuite/20_util/duration_cast/rounding.cc57
-rw-r--r--libstdc++-v3/testsuite/20_util/enable_shared_from_this/members/reinit.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/forward/1_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/20_util/function/cons/72820.cc27
-rw-r--r--libstdc++-v3/testsuite/20_util/function/cons/refqual.cc31
-rw-r--r--libstdc++-v3/testsuite/20_util/function_objects/invoke/59768.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/function_objects/invoke/ref_ext.cc58
-rw-r--r--libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/typedefs.cc36
-rw-r--r--libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/value.cc54
-rw-r--r--libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/value.cc60
-rw-r--r--libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/value.cc66
-rw-r--r--libstdc++-v3/testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc19
-rw-r--r--libstdc++-v3/testsuite/20_util/is_callable/requirements/explicit_instantiation.cc (renamed from libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/explicit_instantiation.cc)10
-rw-r--r--libstdc++-v3/testsuite/20_util/is_callable/requirements/explicit_instantiation_ext.cc28
-rw-r--r--libstdc++-v3/testsuite/20_util/is_callable/requirements/typedefs.cc (renamed from libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/explicit_instantiation.cc)17
-rw-r--r--libstdc++-v3/testsuite/20_util/is_callable/requirements/typedefs_ext.cc (renamed from libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/typedefs.cc)17
-rw-r--r--libstdc++-v3/testsuite/20_util/is_callable/value.cc191
-rw-r--r--libstdc++-v3/testsuite/20_util/is_callable/value_ext.cc26
-rw-r--r--libstdc++-v3/testsuite/20_util/is_floating_point/value.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/is_integral/value.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/explicit_instantiation.cc (renamed from libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/explicit_instantiation.cc)9
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/explicit_instantiation_ext.cc28
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/typedefs.cc (renamed from libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/typedefs.cc)18
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/typedefs_ext.cc29
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_callable/value.cc92
-rw-r--r--libstdc++-v3/testsuite/20_util/is_nothrow_callable/value_ext.cc27
-rw-r--r--libstdc++-v3/testsuite/20_util/is_signed/value.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/is_unsigned/value.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/owner_less/void.cc48
-rw-r--r--libstdc++-v3/testsuite/20_util/pair/astuple/get_neg.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc9
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/ratio/requirements/ratio_equal_v.cc49
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc13
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc13
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/requirements/weak_type.cc31
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc85
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc85
-rw-r--r--libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/time_point_cast/rounding.cc59
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/apply/1.cc67
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/cons/66338.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc3
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/element_access/get_neg.cc61
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc4
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/tuple_size_v.cc33
-rw-r--r--libstdc++-v3/testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc29
-rw-r--r--libstdc++-v3/testsuite/20_util/variable_templates_for_traits.cc344
67 files changed, 1581 insertions, 467 deletions
diff --git a/libstdc++-v3/testsuite/20_util/as_const/1.cc b/libstdc++-v3/testsuite/20_util/as_const/1.cc
new file mode 100644
index 00000000000..2f257b46ff0
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/as_const/1.cc
@@ -0,0 +1,30 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+#include <utility>
+
+#if __cpp_lib_as_const != 201510
+# error "__cpp_lib_as_const != 201510"
+#endif
+
+int i;
+constexpr auto& ci = std::as_const(i);
+static_assert( &i == &ci );
+static_assert( std::is_same_v<decltype(std::as_const(i)), const int&> );
diff --git a/libstdc++-v3/testsuite/20_util/as_const/rvalue_neg.cc b/libstdc++-v3/testsuite/20_util/as_const/rvalue_neg.cc
new file mode 100644
index 00000000000..3fe9e1839da
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/as_const/rvalue_neg.cc
@@ -0,0 +1,28 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+#include <utility>
+
+void test01()
+{
+ int i = 0;
+ std::as_const(std::move(i)); // { dg-error "deleted function" }
+ std::as_const(0); // { dg-error "deleted function" }
+}
diff --git a/libstdc++-v3/testsuite/20_util/bind/is_placeholder_v.cc b/libstdc++-v3/testsuite/20_util/bind/is_placeholder_v.cc
new file mode 100644
index 00000000000..0499d520591
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/bind/is_placeholder_v.cc
@@ -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)>);
+
diff --git a/libstdc++-v3/testsuite/20_util/conditional/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/conditional/requirements/typedefs.cc
index 5729cecec4c..c00db4155a5 100644
--- a/libstdc++-v3/testsuite/20_util/conditional/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/20_util/conditional/requirements/typedefs.cc
@@ -1,4 +1,4 @@
-// { dg-options "-std=gnu++11" }
+// { dg-do compile { target c++11 } }
// 2007-05-02 Benjamin Kosnik <bkoz@redhat.com>
//
@@ -20,22 +20,12 @@
// <http://www.gnu.org/licenses/>.
#include <type_traits>
-#include <testsuite_hooks.h>
-void test01()
-{
- bool test __attribute__((unused)) = true;
- using std::conditional;
+using std::conditional;
+using std::is_same;
- typedef conditional<true, char, int>::type test1_type;
- VERIFY( (std::is_same<test1_type, char>::value) );
+typedef conditional<true, char, int>::type test1_type;
+static_assert( is_same<test1_type, char>::value, "conditional<true, ...>" );
- typedef conditional<false, char, int>::type test2_type;
- VERIFY( (std::is_same<test2_type, int>::value) );
-}
-
-int main()
-{
- test01();
- return 0;
-}
+typedef conditional<false, char, int>::type test2_type;
+static_assert( is_same<test2_type, int>::value, "conditional<false, ...>" );
diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
index 72246b858ff..1c05f61b064 100644
--- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
@@ -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 *-*-* } 2255 }
#include <utility>
diff --git a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
index dbb4af199db..940236ce646 100644
--- a/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
@@ -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 *-*-* } 889 }
}
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc
new file mode 100644
index 00000000000..0148239f5e0
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc
@@ -0,0 +1,33 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+// Copyright (C) 2014-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 <chrono>
+
+using namespace std::chrono;
+
+// These tests are rather simple, the front-end tests already test
+// variable templates, and the library tests for the underlying
+// traits are more elaborate. These are just simple sanity tests.
+
+static_assert(!treat_as_floating_point_v<int>
+ && !treat_as_floating_point<int>::value, "");
+
+static_assert(treat_as_floating_point_v<double>
+ && treat_as_floating_point<double>::value, "");
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
index 14814b4d3fd..db9a4f5bc02 100644
--- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg1.cc
@@ -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 *-*-* } 308 }
// { dg-error "required from here" "" { target *-*-* } 31 }
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
index a71a8895ab9..e562134ffcb 100644
--- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg2.cc
@@ -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 *-*-* } 309 }
// { dg-prune-output "not a member" }
diff --git a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
index 016dc81678e..a71d5b12039 100644
--- a/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
+++ b/libstdc++-v3/testsuite/20_util/duration/requirements/typedefs_neg3.cc
@@ -30,8 +30,7 @@ void test01()
typedef int rep_type;
typedef std::ratio<-1> period_type;
typedef std::chrono::duration<rep_type, period_type> test_type;
- test_type d;
+ test_type d; // { dg-error "required from here" }
}
-// { dg-error "period must be positive" "" { target *-*-* } 249 }
-// { dg-error "required from here" "" { target *-*-* } 33 }
+// { dg-error "period must be positive" "" { target *-*-* } 311 }
diff --git a/libstdc++-v3/testsuite/20_util/duration_cast/rounding.cc b/libstdc++-v3/testsuite/20_util/duration_cast/rounding.cc
new file mode 100644
index 00000000000..a7533230273
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/duration_cast/rounding.cc
@@ -0,0 +1,57 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+#include <chrono>
+
+#if __cpp_lib_chrono < 201510
+# error "__cpp_lib_chrono < 201510"
+#endif
+
+using namespace std::chrono_literals;
+using std::chrono::seconds;
+
+static_assert( std::chrono::floor<seconds>(1000ms) == 1s );
+static_assert( std::chrono::floor<seconds>(1001ms) == 1s );
+static_assert( std::chrono::floor<seconds>(1500ms) == 1s );
+static_assert( std::chrono::floor<seconds>(1999ms) == 1s );
+static_assert( std::chrono::floor<seconds>(2000ms) == 2s );
+static_assert( std::chrono::floor<seconds>(2001ms) == 2s );
+static_assert( std::chrono::floor<seconds>(2500ms) == 2s );
+
+static_assert( std::chrono::ceil<seconds>(1000ms) == 1s );
+static_assert( std::chrono::ceil<seconds>(1001ms) == 2s );
+static_assert( std::chrono::ceil<seconds>(1500ms) == 2s );
+static_assert( std::chrono::ceil<seconds>(1999ms) == 2s );
+static_assert( std::chrono::ceil<seconds>(2000ms) == 2s );
+static_assert( std::chrono::ceil<seconds>(2001ms) == 3s );
+static_assert( std::chrono::ceil<seconds>(2500ms) == 3s );
+
+static_assert( std::chrono::round<seconds>(1000ms) == 1s );
+static_assert( std::chrono::round<seconds>(1001ms) == 1s );
+static_assert( std::chrono::round<seconds>(1499ms) == 1s );
+static_assert( std::chrono::round<seconds>(1500ms) == 2s );
+static_assert( std::chrono::round<seconds>(1999ms) == 2s );
+static_assert( std::chrono::round<seconds>(2000ms) == 2s );
+static_assert( std::chrono::round<seconds>(2001ms) == 2s );
+static_assert( std::chrono::round<seconds>(2500ms) == 2s );
+static_assert( std::chrono::round<seconds>(2501ms) == 3s );
+
+static_assert( std::chrono::abs(100ms) == 100ms );
+static_assert( std::chrono::abs(-100ms) == 100ms );
diff --git a/libstdc++-v3/testsuite/20_util/enable_shared_from_this/members/reinit.cc b/libstdc++-v3/testsuite/20_util/enable_shared_from_this/members/reinit.cc
index 4ce23bc8479..3209f87026a 100644
--- a/libstdc++-v3/testsuite/20_util/enable_shared_from_this/members/reinit.cc
+++ b/libstdc++-v3/testsuite/20_util/enable_shared_from_this/members/reinit.cc
@@ -15,7 +15,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-options "-std=gnu++11" }
+// { dg-do run { target c++11 } }
#include <memory>
#include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/20_util/forward/1_neg.cc b/libstdc++-v3/testsuite/20_util/forward/1_neg.cc
index d2f3477b80a..97851f2df67 100644
--- a/libstdc++-v3/testsuite/20_util/forward/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/forward/1_neg.cc
@@ -27,8 +27,9 @@ template<class T, class A1, class A2>
std::shared_ptr<T>
factory(A1&& a1, A2&& a2)
{
- return std::shared_ptr<T>(new T(std::forward<A1>(a1),
- std::forward<A2>(a2))); // { dg-error "rvalue" }
+ return std::shared_ptr<T>(
+ new T(std::forward<A1>(a1), // { dg-error "rvalue" }
+ std::forward<A2>(a2)));
}
struct A
diff --git a/libstdc++-v3/testsuite/20_util/function/cons/72820.cc b/libstdc++-v3/testsuite/20_util/function/cons/72820.cc
new file mode 100644
index 00000000000..1b17aaebaad
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/function/cons/72820.cc
@@ -0,0 +1,27 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <functional>
+
+struct foo {
+ void operator()() { }
+ static void* operator new(std::size_t, void* p);
+};
+
+std::function<void()> f = foo{};
diff --git a/libstdc++-v3/testsuite/20_util/function/cons/refqual.cc b/libstdc++-v3/testsuite/20_util/function/cons/refqual.cc
new file mode 100644
index 00000000000..23705796557
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/function/cons/refqual.cc
@@ -0,0 +1,31 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <functional>
+
+struct F {
+ void operator()() && { }
+ int operator()() & { return 0; }
+};
+
+int main() {
+ F f;
+ std::function<int()> ff{f};
+ return ff();
+}
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/invoke/59768.cc b/libstdc++-v3/testsuite/20_util/function_objects/invoke/59768.cc
index 2a519eaf64d..6aaae222e52 100644
--- a/libstdc++-v3/testsuite/20_util/function_objects/invoke/59768.cc
+++ b/libstdc++-v3/testsuite/20_util/function_objects/invoke/59768.cc
@@ -21,7 +21,7 @@
#include <functional>
struct A {
- void foo(int n) { }
+ void foo(int) { }
};
void
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/invoke/ref_ext.cc b/libstdc++-v3/testsuite/20_util/function_objects/invoke/ref_ext.cc
new file mode 100644
index 00000000000..d7e57668779
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/function_objects/invoke/ref_ext.cc
@@ -0,0 +1,58 @@
+// Copyright (C) 2015-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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <functional>
+
+struct A {
+ void foo(int) { }
+};
+
+void
+test01()
+{
+ // PR libstdc++/59768
+ A a;
+ auto ref = std::ref(a);
+ std::__invoke(&A::foo, ref, 100); // lvalue
+ std::__invoke(&A::foo, std::move(ref), 100); // rvalue
+ const auto refc = std::ref(a);
+ std::__invoke(&A::foo, refc, 100); // const lvalue
+ std::__invoke(&A::foo, std::move(refc), 100); // const rvalue
+}
+
+struct B {
+ int bar = 0;
+};
+
+void
+test02()
+{
+ B b;
+ // Invocation through a reference_wrapper means the object is an lvalue.
+
+ int* ptr [[gnu::unused]];
+ auto ref = std::ref(b);
+ ptr = &std::__invoke(&B::bar, ref);
+ ptr = &std::__invoke(&B::bar, std::move(ref));
+
+ const int* cptr [[gnu::unused]];
+ auto cref = std::cref(b);
+ cptr = &std::__invoke(&B::bar, cref);
+ cptr = &std::__invoke(&B::bar, std::move(cref));
+}
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/typedefs.cc
deleted file mode 100644
index 61e54c12bb6..00000000000
--- a/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/typedefs.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-// { dg-options "-std=gnu++11 -Wno-deprecated" }
-// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
-//
-// Copyright (C) 2010-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 copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-//
-// NB: This file is for testing type_traits with NO OTHER INCLUDES.
-
-#include <type_traits>
-
-// { dg-do compile }
-
-void test01()
-{
- // Check for required typedefs
- typedef std::has_trivial_copy_assign<int> test_type;
- typedef test_type::value_type value_type;
- typedef test_type::type type;
- typedef test_type::type::value_type type_value_type;
- typedef test_type::type::type type_type;
-}
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/value.cc b/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/value.cc
deleted file mode 100644
index 73a22584acb..00000000000
--- a/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/value.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// { dg-options "-std=gnu++11 -Wno-deprecated" }
-// { dg-do compile }
-
-// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
-//
-// Copyright (C) 2010-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 copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <type_traits>
-#include <testsuite_tr1.h>
-
-void test01()
-{
- using std::has_trivial_copy_assign;
- using namespace __gnu_test;
-
- static_assert(test_property<has_trivial_copy_assign, int>(true), "");
- static_assert(test_property<has_trivial_copy_assign, float>(true), "");
- static_assert(test_property<has_trivial_copy_assign, EnumType>(true), "");
- static_assert(test_property<has_trivial_copy_assign, int*>(true), "");
- static_assert(test_property<has_trivial_copy_assign, int(*)(int)>(true), "");
- static_assert(test_property<has_trivial_copy_assign,
- int (ClassType::*)>(true), "");
- static_assert(test_property<has_trivial_copy_assign,
- int (ClassType::*) (int)>(true), "");
- static_assert(test_property<has_trivial_copy_assign, int[2]>(true), "");
- static_assert(test_property<has_trivial_copy_assign, float[][3]>(true), "");
- static_assert(test_property<has_trivial_copy_assign,
- EnumType[2][3][4]>(true), "");
- static_assert(test_property<has_trivial_copy_assign, int*[3]>(true), "");
- static_assert(test_property<has_trivial_copy_assign,
- int(*[][2])(int)>(true), "");
- static_assert(test_property<has_trivial_copy_assign,
- int (ClassType::*[2][3])>(true), "");
- static_assert(test_property<has_trivial_copy_assign,
- int (ClassType::*[][2][3]) (int)>(true), "");
-
- // Negative tests.
- static_assert(test_property<has_trivial_copy_assign, void>(false), "");
-}
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/value.cc b/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/value.cc
deleted file mode 100644
index 5f7456e0b5a..00000000000
--- a/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/value.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// { dg-options "-std=gnu++11 -Wno-deprecated" }
-// { dg-do compile }
-
-// 2004-12-30 Paolo Carlini <pcarlini@suse.de>
-//
-// Copyright (C) 2004-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 copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 4.5.3 Type properties
-
-#include <type_traits>
-#include <testsuite_tr1.h>
-
-void test01()
-{
- using std::has_trivial_copy_constructor;
- using namespace __gnu_test;
-
- // Positive tests.
- static_assert(test_category<has_trivial_copy_constructor, int>(true), "");
- static_assert(test_category<has_trivial_copy_constructor, float>(true), "");
- static_assert(test_category<has_trivial_copy_constructor,
- EnumType>(true), "");
- static_assert(test_category<has_trivial_copy_constructor, int*>(true), "");
- static_assert(test_category<has_trivial_copy_constructor,
- int(*)(int)>(true), "");
- static_assert(test_category<has_trivial_copy_constructor,
- int (ClassType::*)>(true), "");
- static_assert(test_category<has_trivial_copy_constructor,
- int (ClassType::*) (int)>(true), "");
- static_assert(test_category<has_trivial_copy_constructor, int[2]>(true), "");
- static_assert(test_category<has_trivial_copy_constructor,
- float[][3]>(true), "");
- static_assert(test_category<has_trivial_copy_constructor,
- EnumType[2][3][4]>(true), "");
- static_assert(test_category<has_trivial_copy_constructor, int*[3]>(true), "");
- static_assert(test_category<has_trivial_copy_constructor,
- int(*[][2])(int)>(true), "");
- static_assert(test_category<has_trivial_copy_constructor,
- int (ClassType::*[2][3])>(true), "");
- static_assert(test_category<has_trivial_copy_constructor,
- int (ClassType::*[][2][3]) (int)>(true), "");
-
- // Negative tests.
- static_assert(test_category<has_trivial_copy_constructor, void>(false), "");
-}
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/value.cc b/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/value.cc
deleted file mode 100644
index dae437b3639..00000000000
--- a/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/value.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// { dg-options "-std=gnu++11 -Wno-deprecated" }
-// { dg-do compile }
-
-// 2004-12-26 Paolo Carlini <pcarlini@suse.de>
-//
-// Copyright (C) 2004-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 copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 4.5.3 Type properties
-
-#include <type_traits>
-#include <testsuite_tr1.h>
-
-void test01()
-{
- using std::has_trivial_default_constructor;
- using namespace __gnu_test;
-
- // Positive tests.
- static_assert(test_category<has_trivial_default_constructor, int>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- float>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- EnumType>(true), "");
- static_assert(test_category<has_trivial_default_constructor, int*>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- int(*)(int)>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- int (ClassType::*)>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- int (ClassType::*) (int)>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- int[2]>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- float[][3]>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- EnumType[2][3][4]>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- int*[3]>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- int(*[][2])(int)>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- int (ClassType::*[2][3])>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- int (ClassType::*[][2][3]) (int)>(true), "");
- static_assert(test_category<has_trivial_default_constructor,
- ClassType>(true), "");
-
- // Negative tests.
- static_assert(test_category<has_trivial_default_constructor,
- void>(false), "");
-}
diff --git a/libstdc++-v3/testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc b/libstdc++-v3/testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc
index 0696fad436d..1c65a4b4aa1 100644
--- a/libstdc++-v3/testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/headers/type_traits/types_std_c++0x_neg.cc
@@ -22,15 +22,12 @@
namespace gnu
{
- // C++0x changes from TR1.
- using std::has_trivial_constructor;
- using std::has_nothrow_constructor;
- using std::has_trivial_copy;
- using std::has_nothrow_copy;
+ // C++11 changes from TR1.
+ using std::has_trivial_constructor; // { dg-error "has not been declared" }
+ using std::has_trivial_default_constructor; // { dg-error "has not been declared" }
+ using std::has_nothrow_constructor; // { dg-error "has not been declared" }
+ using std::has_trivial_copy; // { dg-error "has not been declared" }
+ using std::has_trivial_copy_constructor; // { dg-error "has not been declared" }
+ using std::has_trivial_copy_assign; // { dg-error "has not been declared" }
+ using std::has_nothrow_copy; // { dg-error "has not been declared" }
}
-
-// { dg-error "has not been declared" "" { target *-*-* } 26 }
-// { dg-error "has not been declared" "" { target *-*-* } 27 }
-// { dg-error "has not been declared" "" { target *-*-* } 28 }
-// { dg-error "has not been declared" "" { target *-*-* } 29 }
-
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_callable/requirements/explicit_instantiation.cc
index 0a5654c9bf4..0ce5bfe72a8 100644
--- a/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/20_util/is_callable/requirements/explicit_instantiation.cc
@@ -1,8 +1,7 @@
-// { dg-options "-std=gnu++11 -Wno-deprecated" }
+// { dg-options "-std=gnu++17" }
// { dg-do compile }
-// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007-2016 Free Software Foundation, Inc.
+// 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
@@ -19,13 +18,12 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
namespace std
{
- typedef short test_type;
- template struct has_trivial_copy_constructor<test_type>;
+ struct test_type { };
+ template struct is_callable<test_type(), int>;
}
diff --git a/libstdc++-v3/testsuite/20_util/is_callable/requirements/explicit_instantiation_ext.cc b/libstdc++-v3/testsuite/20_util/is_callable/requirements/explicit_instantiation_ext.cc
new file mode 100644
index 00000000000..a3d3f496de8
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_callable/requirements/explicit_instantiation_ext.cc
@@ -0,0 +1,28 @@
+// { dg-do compile { target c++11 } }
+
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+namespace std
+{
+ struct test_type { };
+ template struct __is_callable<test_type(), int>;
+}
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_callable/requirements/typedefs.cc
index cd632136258..9f21dfb90ae 100644
--- a/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/20_util/is_callable/requirements/typedefs.cc
@@ -1,31 +1,30 @@
-// { dg-options "-std=gnu++11 -Wno-deprecated" }
+// { dg-options "-std=gnu++17" }
// { dg-do compile }
-// 2007-04-30 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2007-2016 Free Software Foundation, Inc.
+// 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 copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
-namespace std
+void test01()
{
- typedef short test_type;
- template struct has_trivial_default_constructor<test_type>;
+ // Check for required typedefs
+ typedef std::is_callable<int(), void> test_type;
+ static_assert( std::is_base_of_v<std::false_type, test_type> );
}
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_callable/requirements/typedefs_ext.cc
index 1d055061522..e582be0674a 100644
--- a/libstdc++-v3/testsuite/20_util/has_trivial_copy_constructor/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/20_util/is_callable/requirements/typedefs_ext.cc
@@ -1,7 +1,6 @@
-// { dg-options "-std=gnu++11 -Wno-deprecated" }
-// 2004-12-30 Paolo Carlini <pcarlini@suse.de>
-//
-// Copyright (C) 2004-2016 Free Software Foundation, Inc.
+// { dg-do compile { target c++11 } }
+
+// 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
@@ -18,19 +17,13 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
-// { dg-do compile }
-
void test01()
{
// Check for required typedefs
- typedef std::has_trivial_copy_constructor<int> test_type;
- typedef test_type::value_type value_type;
- typedef test_type::type type;
- typedef test_type::type::value_type type_value_type;
- typedef test_type::type::type type_type;
+ typedef std::__is_callable<int(), void> test_type;
+ static_assert( std::is_base_of<std::false_type, test_type>::value, "" );
}
diff --git a/libstdc++-v3/testsuite/20_util/is_callable/value.cc b/libstdc++-v3/testsuite/20_util/is_callable/value.cc
new file mode 100644
index 00000000000..aafd55f06be
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_callable/value.cc
@@ -0,0 +1,191 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+#include <type_traits>
+
+#ifndef IS_CALLABLE_DEFINED
+template<typename T, typename R = void>
+ constexpr bool is_callable()
+ {
+ static_assert(std::is_callable<T, R>::value == std::is_callable_v<T, R>);
+ return std::is_callable_v<T, R>;
+ }
+#endif
+
+void test01()
+{
+ using func_type_v0 = void(*)();
+
+ static_assert( is_callable< func_type_v0() >(), "");
+ static_assert( is_callable< func_type_v0(), void >(), "");
+ static_assert( ! is_callable< func_type_v0(), void* >(), "");
+ static_assert( ! is_callable< func_type_v0(), int >(), "");
+
+ static_assert( ! is_callable< func_type_v0(int) >(), "");
+ static_assert( ! is_callable< func_type_v0(int), void >(), "");
+ static_assert( ! is_callable< func_type_v0(int), void* >(), "");
+ static_assert( ! is_callable< func_type_v0(int), int >(), "");
+
+ using func_type_i0 = int(*)();
+
+ static_assert( is_callable< func_type_i0() >(), "");
+ static_assert( is_callable< func_type_i0(), void >(), "");
+ static_assert( is_callable< func_type_i0(), int >(), "");
+ static_assert( ! is_callable< func_type_i0(), int& >(), "");
+ static_assert( is_callable< func_type_i0(), long >(), "");
+
+ static_assert( ! is_callable< func_type_i0(int) >(), "");
+ static_assert( ! is_callable< func_type_i0(int), void >(), "");
+ static_assert( ! is_callable< func_type_i0(int), int >(), "");
+ static_assert( ! is_callable< func_type_i0(int), int& >(), "");
+ static_assert( ! is_callable< func_type_i0(int), long >(), "");
+
+ using func_type_l0 = int&(*)();
+
+ static_assert( is_callable< func_type_l0() >(), "");
+ static_assert( is_callable< func_type_l0(), void >(), "");
+ static_assert( is_callable< func_type_l0(), int >(), "");
+ static_assert( is_callable< func_type_l0(), int& >(), "");
+ static_assert( ! is_callable< func_type_l0(), int&& >(), "");
+ static_assert( is_callable< func_type_l0(), long >(), "");
+ static_assert( ! is_callable< func_type_l0(), long& >(), "");
+
+ static_assert( ! is_callable< func_type_l0(int) >(), "");
+ static_assert( ! is_callable< func_type_l0(int), void >(), "");
+ static_assert( ! is_callable< func_type_l0(int), int >(), "");
+ static_assert( ! is_callable< func_type_l0(int), int& >(), "");
+ static_assert( ! is_callable< func_type_l0(int), long >(), "");
+
+ using func_type_ii = int(*)(int);
+
+ static_assert( ! is_callable< func_type_ii() >(), "");
+ static_assert( ! is_callable< func_type_ii(), int >(), "");
+ static_assert( ! is_callable< func_type_ii(), int& >(), "");
+ static_assert( ! is_callable< func_type_ii(), long >(), "");
+
+ static_assert( is_callable< func_type_ii(int) >(), "");
+ static_assert( is_callable< func_type_ii(int), int >(), "");
+ static_assert( ! is_callable< func_type_ii(int), int& >(), "");
+ static_assert( is_callable< func_type_ii(int), long >(), "");
+
+ using func_type_il = int(*)(int&);
+
+ static_assert( ! is_callable< func_type_il() >(), "");
+
+ static_assert( ! is_callable< func_type_il(int) >(), "");
+ static_assert( ! is_callable< func_type_il(int), int >(), "");
+ static_assert( ! is_callable< func_type_il(int), int& >(), "");
+ static_assert( ! is_callable< func_type_il(int), long >(), "");
+
+ static_assert( is_callable< func_type_il(int&) >(), "");
+ static_assert( is_callable< func_type_il(int&), int >(), "");
+ static_assert( ! is_callable< func_type_il(int&), int& >(), "");
+ static_assert( is_callable< func_type_il(int&), long >(), "");
+
+ using func_type_ir = int(*)(int&&);
+
+ static_assert( ! is_callable< func_type_ir() >(), "");
+
+ static_assert( is_callable< func_type_ir(int) >(), "");
+ static_assert( is_callable< func_type_ir(int), int >(), "");
+ static_assert( ! is_callable< func_type_ir(int), int& >(), "");
+ static_assert( is_callable< func_type_ir(int), long >(), "");
+
+ static_assert( ! is_callable< func_type_ir(int&) >(), "");
+ static_assert( ! is_callable< func_type_ir(int&), int >(), "");
+ static_assert( ! is_callable< func_type_ir(int&), int& >(), "");
+ static_assert( ! is_callable< func_type_ir(int&), long >(), "");
+
+ struct X { };
+
+ using mem_type_i = int X::*;
+
+ static_assert( ! is_callable< mem_type_i() >(), "");
+
+ static_assert( ! is_callable< mem_type_i(int) >(), "");
+ static_assert( ! is_callable< mem_type_i(int), int >(), "");
+ static_assert( ! is_callable< mem_type_i(int), int& >(), "");
+ static_assert( ! is_callable< mem_type_i(int), long >(), "");
+
+ static_assert( ! is_callable< mem_type_i(int&) >(), "");
+ static_assert( ! is_callable< mem_type_i(int&), int >(), "");
+ static_assert( ! is_callable< mem_type_i(int&), int& >(), "");
+ static_assert( ! is_callable< mem_type_i(int&), long >(), "");
+
+ static_assert( is_callable< mem_type_i(X&) >(), "");
+ static_assert( is_callable< mem_type_i(X&), int >(), "");
+ static_assert( is_callable< mem_type_i(X&), int& >(), "");
+ static_assert( is_callable< mem_type_i(X&), long >(), "");
+
+ using memfun_type_i = int (X::*)();
+
+ static_assert( ! is_callable< memfun_type_i() >(), "");
+
+ static_assert( ! is_callable< memfun_type_i(int) >(), "");
+
+ static_assert( ! is_callable< memfun_type_i(int&) >(), "");
+
+ static_assert( is_callable< memfun_type_i(X&) >(), "");
+ static_assert( is_callable< memfun_type_i(X&), int >(), "");
+ static_assert( ! is_callable< memfun_type_i(X&), int& >(), "");
+ static_assert( is_callable< memfun_type_i(X&), long >(), "");
+ static_assert( is_callable< memfun_type_i(X*) >(), "");
+
+ static_assert( ! is_callable< memfun_type_i(const X&) >(), "");
+ static_assert( ! is_callable< memfun_type_i(const X&), int >(), "");
+ static_assert( ! is_callable< memfun_type_i(X&, int) >(), "");
+
+ using memfun_type_iic = int& (X::*)(int&) const;
+
+ static_assert( ! is_callable< memfun_type_iic() >(), "");
+ static_assert( ! is_callable< memfun_type_iic(int) >(), "");
+ static_assert( ! is_callable< memfun_type_iic(int&) >(), "");
+ static_assert( ! is_callable< memfun_type_iic(X&, int) >(), "");
+ static_assert( ! is_callable< memfun_type_iic(const X&, int) >(), "");
+ static_assert( ! is_callable< memfun_type_iic(const X&, int&, int) >(), "");
+
+ static_assert( is_callable< memfun_type_iic(const X&, int&) >(), "");
+ static_assert( is_callable< memfun_type_iic(const X&, int&), int >(), "");
+ static_assert( is_callable< memfun_type_iic(const X&, int&), int& >(), "");
+ static_assert( is_callable< memfun_type_iic(const X&, int&), long >(), "");
+ static_assert( ! is_callable< memfun_type_iic(const X&, int&), long& >(),"");
+ static_assert( is_callable< memfun_type_iic(const X*, int&) >(), "");
+
+ struct F {
+ int& operator()();
+ long& operator()() const;
+ short& operator()(int) &&;
+ char& operator()(int) const&;
+ private:
+ void operator()(int, int);
+ };
+ using CF = const F;
+
+ static_assert( is_callable< F(), int& >(), "");
+ static_assert( is_callable< F&(), int& >(), "");
+ static_assert( is_callable< CF(), long& >(), "");
+ static_assert( is_callable< CF&(), long& >(), "");
+ static_assert( is_callable< F(int), short& >(), "");
+ static_assert( is_callable< F&(int), char& >(), "");
+ static_assert( is_callable< CF(int), char& >(), "");
+ static_assert( is_callable< CF&(int), char& >(), "");
+
+ static_assert( ! is_callable< F(int, int) >(), "");
+}
diff --git a/libstdc++-v3/testsuite/20_util/is_callable/value_ext.cc b/libstdc++-v3/testsuite/20_util/is_callable/value_ext.cc
new file mode 100644
index 00000000000..3884d6c517e
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_callable/value_ext.cc
@@ -0,0 +1,26 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <type_traits>
+
+template<typename T, typename R = void>
+ constexpr bool is_callable() { return std::__is_callable<T, R>::value; }
+
+#define IS_CALLABLE_DEFINED
+#include "value.cc"
diff --git a/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc b/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc
index 8ed73fcce2a..c2736fae3f7 100644
--- a/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc
+++ b/libstdc++-v3/testsuite/20_util/is_floating_point/value.cc
@@ -47,6 +47,7 @@ void test01()
static_assert(test_category<is_floating_point, double>(true), "");
static_assert(test_category<is_floating_point, long double>(true), "");
+#ifndef __STRICT_ANSI__
// GNU Extensions.
#ifdef _GLIBCXX_USE_FLOAT128
static_assert(test_category<is_floating_point, __float128>(true), "");
@@ -57,6 +58,7 @@ void test01()
static_assert(test_category<is_floating_point,
unsigned __int128>(false), "");
#endif
+#endif
// Sanity check.
static_assert(test_category<is_floating_point, ClassType>(false), "");
diff --git a/libstdc++-v3/testsuite/20_util/is_integral/value.cc b/libstdc++-v3/testsuite/20_util/is_integral/value.cc
index 7d1cb9e5444..56974dcd502 100644
--- a/libstdc++-v3/testsuite/20_util/is_integral/value.cc
+++ b/libstdc++-v3/testsuite/20_util/is_integral/value.cc
@@ -51,6 +51,7 @@ void test01()
static_assert(test_category<is_integral, double>(false), "");
static_assert(test_category<is_integral, long double>(false), "");
+#ifndef __STRICT_ANSI__
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
static_assert(test_category<is_integral, __int128>(true), "");
@@ -60,6 +61,7 @@ void test01()
#ifdef _GLIBCXX_USE_FLOAT128
static_assert(test_category<is_integral, __float128>(false), "");
#endif
+#endif
// Sanity check.
static_assert(test_category<is_integral, ClassType>(false), "");
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/explicit_instantiation.cc
index 6393089c3aa..dbcdd9fd34c 100644
--- a/libstdc++-v3/testsuite/20_util/has_trivial_copy_assign/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/explicit_instantiation.cc
@@ -1,8 +1,7 @@
-// { dg-options "-std=gnu++11 -Wno-deprecated" }
+// { dg-options "-std=gnu++17" }
// { dg-do compile }
-// 2010-06-08 Paolo Carlini <paolo.carlini@oracle.com>
-// Copyright (C) 2010-2016 Free Software Foundation, Inc.
+// 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
@@ -25,6 +24,6 @@
namespace std
{
- typedef short test_type;
- template struct has_trivial_copy_assign<test_type>;
+ struct test_type { };
+ template struct is_nothrow_callable<test_type(), int>;
}
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/explicit_instantiation_ext.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/explicit_instantiation_ext.cc
new file mode 100644
index 00000000000..9e4f74f5d20
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/explicit_instantiation_ext.cc
@@ -0,0 +1,28 @@
+// { dg-do compile { target c++11 } }
+
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+namespace std
+{
+ struct test_type { };
+ template struct __is_nothrow_callable<test_type(), int>;
+}
diff --git a/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/typedefs.cc
index 80f0b6cfb57..395eb156e12 100644
--- a/libstdc++-v3/testsuite/20_util/has_trivial_default_constructor/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/typedefs.cc
@@ -1,7 +1,7 @@
-// { dg-options "-std=gnu++11 -Wno-deprecated" }
-// 2004-12-26 Paolo Carlini <pcarlini@suse.de>
-//
-// Copyright (C) 2004-2016 Free Software Foundation, Inc.
+// { 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
@@ -18,19 +18,13 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-//
// NB: This file is for testing type_traits with NO OTHER INCLUDES.
#include <type_traits>
-// { dg-do compile }
-
void test01()
{
// Check for required typedefs
- typedef std::has_trivial_default_constructor<int> test_type;
- typedef test_type::value_type value_type;
- typedef test_type::type type;
- typedef test_type::type::value_type type_value_type;
- typedef test_type::type::type type_type;
+ typedef std::is_nothrow_callable<int(), void> test_type;
+ static_assert( std::is_base_of_v<std::false_type, test_type> );
}
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/typedefs_ext.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/typedefs_ext.cc
new file mode 100644
index 00000000000..23df15ebd58
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/requirements/typedefs_ext.cc
@@ -0,0 +1,29 @@
+// { dg-do compile { target c++11 } }
+
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NB: This file is for testing type_traits with NO OTHER INCLUDES.
+
+#include <type_traits>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::__is_nothrow_callable<int(), void> test_type;
+ static_assert( std::is_base_of<std::false_type, test_type>::value, "" );
+}
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_callable/value.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/value.cc
new file mode 100644
index 00000000000..b24d369d39d
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/value.cc
@@ -0,0 +1,92 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+#include <type_traits>
+
+#ifndef IS_NT_CALLABLE_DEFINED
+template<typename T, typename R = void>
+ constexpr bool is_nt_callable()
+ {
+ static_assert(std::is_nothrow_callable<T, R>::value
+ == std::is_nothrow_callable_v<T, R>);
+ return std::is_nothrow_callable_v<T, R>;
+ }
+#endif
+
+void test01()
+{
+ using func_type = void(*)();
+ static_assert( ! is_nt_callable< func_type() >(), "");
+
+#if __cpp_noexcept_function_type
+ using func_type_nt = void(*)() noexcept;
+ static_assert( is_nt_callable< func_type_nt() >(), "");
+#endif
+
+ struct X { };
+ using mem_type = int X::*;
+
+ static_assert( ! is_nt_callable< mem_type() >(), "");
+ static_assert( ! is_nt_callable< mem_type(int) >(), "");
+ static_assert( ! is_nt_callable< mem_type(int&) >(), "");
+
+ static_assert( is_nt_callable< mem_type(X&) >(), "");
+ static_assert( is_nt_callable< mem_type(X&), int >(), "");
+ static_assert( is_nt_callable< mem_type(X&), int& >(), "");
+ static_assert( is_nt_callable< mem_type(X&), long >(), "");
+ static_assert( is_nt_callable< mem_type(X*), int& >(), "");
+
+ using memfun_type = int (X::*)();
+
+ static_assert( ! is_nt_callable< memfun_type() >(), "");
+ static_assert( ! is_nt_callable< memfun_type(int) >(), "");
+ static_assert( ! is_nt_callable< memfun_type(int&) >(), "");
+ static_assert( ! is_nt_callable< memfun_type(X&) >(), "");
+ static_assert( ! is_nt_callable< memfun_type(X*) >(), "");
+
+#if __cpp_noexcept_function_type
+ using memfun_type_nt = int (X::*)() noexcept;
+
+ static_assert( ! is_nt_callable< memfun_type_nt() >(), "");
+ static_assert( ! is_nt_callable< memfun_type_nt(int) >(), "");
+ static_assert( ! is_nt_callable< memfun_type_nt(int&) >(), "");
+ static_assert( is_nt_callable< memfun_type_nt(X&) >(), "");
+ static_assert( is_nt_callable< memfun_type_nt(X*) >(), "");
+#endif
+
+ struct F {
+ int& operator()();
+ long& operator()() const noexcept;
+ short& operator()(int) &&;
+ char& operator()(int) const& noexcept;
+ private:
+ void operator()(int, int) noexcept;
+ };
+ using CF = const F;
+
+ static_assert( ! is_nt_callable< F(), int& >(), "");
+ static_assert( is_nt_callable< CF(), long& >(), "");
+ static_assert( ! is_nt_callable< F(int), short& >(), "");
+ static_assert( is_nt_callable< F&(int), char& >(), "");
+ static_assert( is_nt_callable< CF(int), char& >(), "");
+ static_assert( is_nt_callable< CF&(int), char& >(), "");
+
+ static_assert( ! is_nt_callable< F(int, int) >(), "");
+}
diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_callable/value_ext.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/value_ext.cc
new file mode 100644
index 00000000000..8d84db629d1
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/is_nothrow_callable/value_ext.cc
@@ -0,0 +1,27 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <type_traits>
+
+template<typename T, typename R = void>
+ constexpr bool is_nt_callable()
+ { return std::__is_nothrow_callable<T, R>::value; }
+
+#define IS_NT_CALLABLE_DEFINED
+#include "value.cc"
diff --git a/libstdc++-v3/testsuite/20_util/is_signed/value.cc b/libstdc++-v3/testsuite/20_util/is_signed/value.cc
index ab09d0cb4b3..2e251035faa 100644
--- a/libstdc++-v3/testsuite/20_util/is_signed/value.cc
+++ b/libstdc++-v3/testsuite/20_util/is_signed/value.cc
@@ -50,6 +50,7 @@ void test01()
static_assert(test_category<is_signed, double>(true), "");
static_assert(test_category<is_signed, long double>(true), "");
+#ifndef __STRICT_ANSI__
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
static_assert(test_category<is_signed, __int128>(true), "");
@@ -59,6 +60,7 @@ void test01()
#ifdef _GLIBCXX_USE_FLOAT128
static_assert(test_category<is_signed, __float128>(true), "");
#endif
+#endif
// Sanity check.
static_assert(test_category<is_signed, ClassType>(false), "");
diff --git a/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc b/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc
index 3ced5bb730f..75bec3b379a 100644
--- a/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc
+++ b/libstdc++-v3/testsuite/20_util/is_unsigned/value.cc
@@ -50,6 +50,7 @@ void test01()
static_assert(test_category<is_unsigned, double>(false), "");
static_assert(test_category<is_unsigned, long double>(false), "");
+#ifndef __STRICT_ANSI__
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
static_assert(test_category<is_unsigned, unsigned __int128>(true), "");
@@ -59,6 +60,7 @@ void test01()
#ifdef _GLIBCXX_USE_FLOAT128
static_assert(test_category<is_unsigned, __float128>(false), "");
#endif
+#endif
// Sanity check.
static_assert(test_category<is_unsigned, ClassType>(false), "");
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc
index be8d4b05844..40b9fb8b73d 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc
@@ -67,6 +67,7 @@ void test01()
static_assert( sizeof(test24_type) == sizeof(test_enum),
"make_signed<test_enum> makes type of same size" );
+#ifndef __STRICT_ANSI__
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
typedef make_signed<unsigned __int128>::type test25_type;
@@ -77,4 +78,5 @@ void test01()
static_assert( is_same<test26_type, __int128>::value,
"make_signed<__int128>" );
#endif
+#endif
}
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
index 2378db19e6a..1da917336c2 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
@@ -1,5 +1,4 @@
// { dg-options "-std=gnu++11 -funsigned-char -fshort-enums" }
-// { dg-options "-std=gnu++11 -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux-* } }
// { dg-do compile }
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
@@ -60,6 +59,7 @@ void test01()
typedef make_signed<test_enum>::type test24_type;
static_assert(is_same<test24_type, short>::value, "");
+#ifndef __STRICT_ANSI__
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
typedef make_signed<unsigned __int128>::type test25_type;
@@ -68,4 +68,5 @@ void test01()
typedef make_signed<__int128>::type test26_type;
static_assert(is_same<test26_type, __int128>::value, "");
#endif
+#endif
}
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
index 772457992ec..69e21b64035 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
@@ -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 *-*-* } 1920 }
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc
index 5971cab8966..09b63bbd3f1 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc
@@ -61,6 +61,7 @@ void test01()
static_assert(is_unsigned<test24_type>::value, "");
static_assert(sizeof(test24_type) == sizeof(test_enum), "");
+#ifndef __STRICT_ANSI__
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
typedef make_unsigned<unsigned __int128>::type test25_type;
@@ -69,4 +70,5 @@ void test01()
typedef make_unsigned<__int128>::type test26_type;
static_assert(is_same<test26_type, unsigned __int128>::value, "");
#endif
+#endif
}
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
index 19aa5d31b49..bb40fcc1e28 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
@@ -1,5 +1,4 @@
// { dg-options "-std=gnu++11 -funsigned-char -fshort-enums" }
-// { dg-options "-std=gnu++11 -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux-* } }
// { dg-do compile }
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
@@ -60,6 +59,7 @@ void test01()
typedef make_unsigned<test_enum>::type test24_type;
static_assert(is_same<test24_type, unsigned short>::value, "");
+#ifndef __STRICT_ANSI__
// GNU Extensions.
#ifdef _GLIBCXX_USE_INT128
typedef make_unsigned<unsigned __int128>::type test25_type;
@@ -68,4 +68,5 @@ void test01()
typedef make_unsigned<__int128>::type test26_type;
static_assert(is_same<test26_type, unsigned __int128>::value, "");
#endif
+#endif
}
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
index 75fadf40b04..5240c3e93eb 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
@@ -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 *-*-* } 1816 }
+// { dg-error "declaration of" "" { target *-*-* } 1773 }
diff --git a/libstdc++-v3/testsuite/20_util/owner_less/void.cc b/libstdc++-v3/testsuite/20_util/owner_less/void.cc
new file mode 100644
index 00000000000..4facbf57001
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/owner_less/void.cc
@@ -0,0 +1,48 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile { target c++11 } }
+
+#include <memory>
+
+#if __cplusplus >= 201402L
+// The feature-test macro is only defined for C++14 and later.
+# if __cpp_lib_transparent_operators < 201510
+# error "__cpp_lib_transparent_operators < 201510"
+# endif
+#endif
+
+void
+test01()
+{
+ using namespace std;
+
+ static_assert(is_same<owner_less<>, owner_less<void>>::value,
+ "owner_less<> uses void specialization");
+
+ shared_ptr<int> sp1;
+ shared_ptr<void> sp2;
+ shared_ptr<long> sp3;
+ weak_ptr<int> wp1;
+
+ owner_less<> cmp;
+ cmp(sp1, sp2);
+ cmp(sp1, wp1);
+ cmp(sp1, sp3);
+ cmp(wp1, sp1);
+ cmp(wp1, wp1);
+}
diff --git a/libstdc++-v3/testsuite/20_util/pair/astuple/get_neg.cc b/libstdc++-v3/testsuite/20_util/pair/astuple/get_neg.cc
index f980b87ea6a..ea251b83385 100644
--- a/libstdc++-v3/testsuite/20_util/pair/astuple/get_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/pair/astuple/get_neg.cc
@@ -1,5 +1,4 @@
-// { dg-do compile }
-// { dg-options "-std=gnu++14" }
+// { dg-do compile { target c++11 } }
// Copyright (C) 2013-2016 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc b/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc
index c23bb91d4c0..e7e140d436b 100644
--- a/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc
+++ b/libstdc++-v3/testsuite/20_util/pair/requirements/dr801.cc
@@ -36,10 +36,6 @@ void test_trivial()
// Negative
/*
- static_assert(std::has_trivial_default_constructor<pair_type>::value,
- "! triv default");
- static_assert(std::has_trivial_copy_assign<pair_type>::value,
- "! triv assign");
static_assert(std::is_trivial<pair_type>::value, "! triv");
static_assert(std::is_pod<pair_type>::value, "! pod");
*/
diff --git a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
index 5f3e68b1f1f..a101d2938a7 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc
@@ -31,24 +31,21 @@ test01()
void
test02()
{
- std::ratio<INTMAX_MIN, 1> r1 __attribute__((unused));
+ std::ratio<INTMAX_MIN, 1> r1 __attribute__((unused)); // { dg-error "required from here" }
}
void
test03()
{
- std::ratio<1, INTMAX_MIN> r1 __attribute__((unused));
+ std::ratio<1, INTMAX_MIN> r1 __attribute__((unused)); // { dg-error "required from here"
}
void
test04()
{
- std::ratio<1,0> r1 __attribute__((unused));
+ std::ratio<1,0> r1 __attribute__((unused)); // { dg-error "required from here"
}
-// { dg-error "required from here" "" { target *-*-* } 34 }
-// { dg-error "required from here" "" { target *-*-* } 40 }
-// { dg-error "required from here" "" { target *-*-* } 46 }
// { dg-error "denominator cannot be zero" "" { target *-*-* } 265 }
// { dg-error "out of range" "" { target *-*-* } 266 }
// { dg-error "overflow in constant expression" "" { target *-*-* } 61 }
diff --git a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc
index 0efa556ffdf..1a6bc52d7e0 100644
--- a/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/ratio/operations/ops_overflow_neg.cc
@@ -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 }
diff --git a/libstdc++-v3/testsuite/20_util/ratio/requirements/ratio_equal_v.cc b/libstdc++-v3/testsuite/20_util/ratio/requirements/ratio_equal_v.cc
new file mode 100644
index 00000000000..1158a67dd39
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/ratio/requirements/ratio_equal_v.cc
@@ -0,0 +1,49 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+// Copyright (C) 2014-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 <ratio>
+
+using namespace std;
+
+// These tests are rather simple, the front-end tests already test
+// variable templates, and the library tests for the underlying
+// traits are more elaborate. These are just simple sanity tests.
+
+static_assert(ratio_equal_v<ratio<1, 3>, ratio<2, 6>>
+ && ratio_equal<ratio<1, 3>, ratio<2, 6>>::value, "");
+
+static_assert(ratio_not_equal_v<ratio<1, 3>, ratio<2, 5>>
+ && ratio_not_equal<ratio<1, 3>, ratio<2, 5>>::value, "");
+
+static_assert(ratio_less_v<ratio<1, 4>, ratio<1, 3>>
+ && ratio_less<ratio<1, 4>, ratio<1, 3>>::value, "");
+
+static_assert(ratio_less_equal_v<ratio<1, 4>, ratio<1, 4>>
+ && ratio_less_equal_v<ratio<1, 4>, ratio<1, 3>>
+ && ratio_less_equal<ratio<1, 4>, ratio<1, 4>>::value
+ && ratio_less_equal<ratio<1, 4>, ratio<1, 3>>::value, "");
+
+static_assert(ratio_greater_v<ratio<1, 3>, ratio<1, 4>>
+ && ratio_greater<ratio<1, 3>, ratio<1, 4>>::value, "");
+
+static_assert(ratio_greater_equal_v<ratio<1, 4>, ratio<1, 4>>
+ && ratio_greater_equal_v<ratio<1, 3>, ratio<1, 4>>
+ && ratio_greater_equal<ratio<1, 4>, ratio<1, 4>>::value
+ && ratio_greater_equal<ratio<1, 3>, ratio<1, 4>>::value, "");
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc
index edd3ffeeb03..f1f399c5f36 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue.cc
@@ -21,7 +21,6 @@
// 20.7.12.2 Template class shared_ptr [util.smartptr.shared]
#include <memory>
-#include <testsuite_hooks.h>
struct A { };
std::auto_ptr<A> source() { return std::auto_ptr<A>(); }
@@ -29,27 +28,19 @@ std::auto_ptr<A> source() { return std::auto_ptr<A>(); }
// 20.7.12.2.3 shared_ptr assignment [util.smartptr.shared.assign]
// Assignment from rvalue auto_ptr
-int
+void
test01()
{
- bool test __attribute__((unused)) = true;
-
std::shared_ptr<A> a;
a = source();
-
- return 0;
}
-int
+void
test02()
{
- bool test __attribute__((unused)) = true;
-
std::shared_ptr<A> a;
std::auto_ptr<A> au;
a = std::move(au);
-
- return 0;
}
int
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc
index 4dd514e5926..58334375c38 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_rvalue.cc
@@ -21,7 +21,6 @@
// 20.7.12.2 Template class shared_ptr [util.smartptr.shared]
#include <memory>
-#include <testsuite_hooks.h>
struct A { };
std::unique_ptr<A> source() { return std::unique_ptr<A>(); }
@@ -29,27 +28,19 @@ std::unique_ptr<A> source() { return std::unique_ptr<A>(); }
// 20.7.12.2.3 shared_ptr assignment [util.smartptr.shared.assign]
// Assignment from rvalue unique_ptr
-int
+void
test01()
{
- bool test __attribute__((unused)) = true;
-
std::shared_ptr<A> a;
a = source();
-
- return 0;
}
-int
+void
test02()
{
- bool test __attribute__((unused)) = true;
-
std::shared_ptr<A> a;
std::unique_ptr<A> u;
a = std::move(u);
-
- return 0;
}
int
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc
index 395094f8bbe..1b3dc1d550b 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc
@@ -32,7 +32,7 @@ void test01()
{
X* px = 0;
std::shared_ptr<X> p1(px); // { dg-error "here" }
- // { dg-error "incomplete" "" { target *-*-* } 889 }
+ // { dg-error "incomplete" "" { target *-*-* } 893 }
std::shared_ptr<X> p9(ap()); // { dg-error "here" }
// { dg-error "incomplete" "" { target *-*-* } 307 }
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc
index 8843ffea429..399d2f08387 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc
@@ -25,5 +25,5 @@
void test01()
{
std::shared_ptr<void> p((void*)nullptr); // { dg-error "here" }
- // { dg-error "incomplete" "" { target *-*-* } 888 }
+ // { dg-error "incomplete" "" { target *-*-* } 892 }
}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/weak_type.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/weak_type.cc
new file mode 100644
index 00000000000..38f95022dbd
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/weak_type.cc
@@ -0,0 +1,31 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+#include <memory>
+
+using std::shared_ptr;
+using std::weak_ptr;
+using std::is_same_v;
+
+static_assert( is_same_v<shared_ptr<int>::weak_type, weak_ptr<int>> );
+static_assert( is_same_v<shared_ptr<void>::weak_type, weak_ptr<void>> );
+
+struct X { };
+static_assert( is_same_v<shared_ptr<X>::weak_type, weak_ptr<X>> );
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
index d5b9d4fa91f..a853307b7c5 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
@@ -25,11 +25,11 @@
#include <memory>
#include <random>
#include <vector>
-#include <testsuite_hooks.h>
#include <iostream>
#include <cstdlib>
-
-#include <pthread.h>
+#include <thread>
+#include <atomic>
+#include <testsuite_hooks.h>
#ifdef _GLIBCXX_HAVE_UNISTD_H
#include <unistd.h> // To test for _POSIX_THREAD_PRIORITY_SCHEDULING
@@ -50,19 +50,13 @@ const unsigned long HAMMER_REPEAT = 100000;
const unsigned long KILL_ONE_IN = 1000;
struct A
- {
- static _Atomic_word counter;
- A()
- {
- __gnu_cxx::__atomic_add(&counter, 1);
- }
- ~A()
- {
- __gnu_cxx::__atomic_add(&counter, -1);
- }
- };
+{
+ static std::atomic<int> counter;
+ A() { counter.fetch_add(1, std::memory_order_relaxed); }
+ ~A() { counter.fetch_sub(1, std::memory_order_relaxed); }
+};
-_Atomic_word A::counter = 0;
+std::atomic<int> A::counter{ 0 };
typedef std::shared_ptr<A> sp_A_t;
typedef std::weak_ptr<A> wp_A_t;
@@ -80,16 +74,10 @@ struct shared_and_weak_pools
{ }
};
-void* thread_hammer_and_kill(void* opaque_pools)
+void thread_hammer_and_kill(shared_and_weak_pools& pools)
{
- shared_and_weak_pools& pools = *static_cast<shared_and_weak_pools*>(opaque_pools);
- // Using the same parameters as in the RNG test cases.
- std::mersenne_twister_engine<
- unsigned long, 32, 624, 397, 31,
- 0x9908b0dful, 11,
- 0xfffffffful, 7,
- 0x9d2c5680ul, 15,
- 0xefc60000ul, 18, 1812433253ul> rng;
+ std::mt19937 urbg;
+ std::uniform_int_distribution<> dist(0, KILL_ONE_IN - 1);
sp_vector_t::iterator cur_shared = pools.shared_pool.begin();
wp_vector_t::iterator cur_weak = pools.weak_pool.begin();
@@ -107,26 +95,16 @@ void* thread_hammer_and_kill(void* opaque_pools)
break;
}
- if (rng() % KILL_ONE_IN == 0)
+ if (dist(urbg) == 0)
{
cur_shared->reset();
++cur_shared;
}
}
- return 0;
}
-void* thread_hammer(void* opaque_weak)
+void thread_hammer(wp_vector_t& weak_pool)
{
- wp_vector_t& weak_pool = *static_cast<wp_vector_t*>(opaque_weak);
- // Using the same parameters as in the RNG test cases.
- std::mersenne_twister_engine<
- unsigned long, 32, 624, 397, 31,
- 0x9908b0dful, 11,
- 0xfffffffful, 7,
- 0x9d2c5680ul, 15,
- 0xefc60000ul, 18, 1812433253ul> rng;
-
wp_vector_t::iterator cur_weak = weak_pool.begin();
for (unsigned int i = 0; i < HAMMER_REPEAT; ++i)
@@ -142,51 +120,38 @@ void* thread_hammer(void* opaque_weak)
break;
}
}
- return 0;
}
-int
+void
test01()
{
bool test __attribute__((unused)) = true;
sp_vector_t obj_pool(POOL_SIZE);
- for(sp_vector_t::iterator cur = obj_pool.begin(); cur != obj_pool.end(); ++cur)
- {
- cur->reset(new A);
- }
+ for(auto& obj : obj_pool)
+ obj.reset(new A);
+
// Obtain weak references.
std::vector<wp_vector_t> weak_pool(HAMMER_MAX_THREADS, wp_vector_t(obj_pool.begin(), obj_pool.end()));
// Launch threads with pointer to weak reference.
- pthread_t threads[HAMMER_MAX_THREADS];
+ std::thread threads[HAMMER_MAX_THREADS];
#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
pthread_setconcurrency (HAMMER_MAX_THREADS);
#endif
- pthread_attr_t tattr;
- pthread_attr_init(&tattr);
-
shared_and_weak_pools pools(obj_pool, weak_pool[0]);
- pthread_create(threads, &tattr, thread_hammer_and_kill, static_cast<void*>(&pools));
+ threads[0] = std::thread(thread_hammer_and_kill, std::ref(pools));
for (unsigned int worker = 1; worker < HAMMER_MAX_THREADS; worker++)
- {
- if (pthread_create(&threads[worker], &tattr,
- thread_hammer, static_cast<void*>(&weak_pool[worker])))
- std::abort();
- }
+ threads[worker] = std::thread(thread_hammer, std::ref(weak_pool[worker]));
+
// Wait for threads to complete, then check integrity of reference.
- void* status;
- for (unsigned int worker = 0; worker < HAMMER_MAX_THREADS; worker++)
- {
- if (pthread_join(threads[worker], &status))
- std::abort();
- }
+ for (auto& thread : threads)
+ thread.join();
+
obj_pool.clear();
VERIFY( A::counter == 0 );
-
- return 0;
}
int
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc
index 9a01716b741..404fc46d50e 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc
@@ -25,11 +25,11 @@
#include <memory>
#include <random>
#include <vector>
-#include <testsuite_hooks.h>
#include <iostream>
#include <cstdlib>
-
-#include <pthread.h>
+#include <thread>
+#include <atomic>
+#include <testsuite_hooks.h>
#ifdef _GLIBCXX_HAVE_UNISTD_H
#include <unistd.h> // To test for _POSIX_THREAD_PRIORITY_SCHEDULING
@@ -50,19 +50,13 @@ const unsigned long HAMMER_REPEAT = 100000;
const unsigned long KILL_ONE_IN = 1000;
struct A
- {
- static _Atomic_word counter;
- A()
- {
- __gnu_cxx::__atomic_add(&counter, 1);
- }
- ~A()
- {
- __gnu_cxx::__atomic_add(&counter, -1);
- }
- };
+{
+ static std::atomic<int> counter;
+ A() { counter.fetch_add(1, std::memory_order_relaxed); }
+ ~A() { counter.fetch_sub(1, std::memory_order_relaxed); }
+};
-_Atomic_word A::counter = 0;
+std::atomic<int> A::counter{0};
using std::_S_mutex;
@@ -82,16 +76,10 @@ struct shared_and_weak_pools
{ }
};
-void* thread_hammer_and_kill(void* opaque_pools)
+void thread_hammer_and_kill(shared_and_weak_pools& pools)
{
- shared_and_weak_pools& pools = *static_cast<shared_and_weak_pools*>(opaque_pools);
- // Using the same parameters as in the RNG test cases.
- std::mersenne_twister_engine<
- unsigned long, 32, 624, 397, 31,
- 0x9908b0dful, 11,
- 0xfffffffful, 7,
- 0x9d2c5680ul, 15,
- 0xefc60000ul, 18, 1812433253ul> rng;
+ std::mt19937 urbg;
+ std::uniform_int_distribution<> dist(0, KILL_ONE_IN - 1);
sp_vector_t::iterator cur_shared = pools.shared_pool.begin();
wp_vector_t::iterator cur_weak = pools.weak_pool.begin();
@@ -109,26 +97,16 @@ void* thread_hammer_and_kill(void* opaque_pools)
break;
}
- if (rng() % KILL_ONE_IN == 0)
+ if (dist(urbg) == 0)
{
cur_shared->reset();
++cur_shared;
}
}
- return 0;
}
-void* thread_hammer(void* opaque_weak)
+void thread_hammer(wp_vector_t& weak_pool)
{
- wp_vector_t& weak_pool = *static_cast<wp_vector_t*>(opaque_weak);
- // Using the same parameters as in the RNG test cases.
- std::mersenne_twister_engine<
- unsigned long, 32, 624, 397, 31,
- 0x9908b0dful, 11,
- 0xfffffffful, 7,
- 0x9d2c5680ul, 15,
- 0xefc60000ul, 18, 1812433253ul> rng;
-
wp_vector_t::iterator cur_weak = weak_pool.begin();
for (unsigned int i = 0; i < HAMMER_REPEAT; ++i)
@@ -144,51 +122,38 @@ void* thread_hammer(void* opaque_weak)
break;
}
}
- return 0;
}
-int
+void
test01()
{
bool test __attribute__((unused)) = true;
sp_vector_t obj_pool(POOL_SIZE);
- for(sp_vector_t::iterator cur = obj_pool.begin(); cur != obj_pool.end(); ++cur)
- {
- cur->reset(new A);
- }
+ for(auto& obj : obj_pool)
+ obj.reset(new A);
+
// Obtain weak references.
std::vector<wp_vector_t> weak_pool(HAMMER_MAX_THREADS, wp_vector_t(obj_pool.begin(), obj_pool.end()));
// Launch threads with pointer to weak reference.
- pthread_t threads[HAMMER_MAX_THREADS];
+ std::thread threads[HAMMER_MAX_THREADS];
#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500
pthread_setconcurrency (HAMMER_MAX_THREADS);
#endif
- pthread_attr_t tattr;
- pthread_attr_init(&tattr);
-
shared_and_weak_pools pools(obj_pool, weak_pool[0]);
- pthread_create(threads, &tattr, thread_hammer_and_kill, static_cast<void*>(&pools));
+ threads[0] = std::thread(thread_hammer_and_kill, std::ref(pools));
for (unsigned int worker = 1; worker < HAMMER_MAX_THREADS; worker++)
- {
- if (pthread_create(&threads[worker], &tattr,
- thread_hammer, static_cast<void*>(&weak_pool[worker])))
- std::abort();
- }
+ threads[worker] = std::thread(thread_hammer, std::ref(weak_pool[worker]));
+
// Wait for threads to complete, then check integrity of reference.
- void* status;
- for (unsigned int worker = 0; worker < HAMMER_MAX_THREADS; worker++)
- {
- if (pthread_join(threads[worker], &status))
- std::abort();
- }
+ for (auto& thread : threads)
+ thread.join();
+
obj_pool.clear();
VERIFY( A::counter == 0 );
-
- return 0;
}
int
diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc
index 179e7471707..e2196444cf3 100644
--- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc
+++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/808590.cc
@@ -15,7 +15,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-options "-std=gnu++03" }
+// { dg-options "-std=gnu++98" }
#include <vector>
#include <stdexcept>
diff --git a/libstdc++-v3/testsuite/20_util/time_point_cast/rounding.cc b/libstdc++-v3/testsuite/20_util/time_point_cast/rounding.cc
new file mode 100644
index 00000000000..bf596e92fc1
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/time_point_cast/rounding.cc
@@ -0,0 +1,59 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do run { target c++11 } }
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+#include <chrono>
+
+#if __cpp_lib_chrono < 201510
+# error "__cpp_lib_chrono < 201510"
+#endif
+
+using namespace std::chrono_literals;
+using std::chrono::seconds;
+using std::chrono::milliseconds;
+
+constexpr std::chrono::system_clock::time_point base{};
+
+static_assert( std::chrono::floor<seconds>(base + 1000ms) == (base + 1s) );
+static_assert( std::chrono::floor<seconds>(base + 1001ms) == (base + 1s) );
+static_assert( std::chrono::floor<seconds>(base + 1500ms) == (base + 1s) );
+static_assert( std::chrono::floor<seconds>(base + 1999ms) == (base + 1s) );
+static_assert( std::chrono::floor<seconds>(base + 2000ms) == (base + 2s) );
+static_assert( std::chrono::floor<seconds>(base + 2001ms) == (base + 2s) );
+static_assert( std::chrono::floor<seconds>(base + 2500ms) == (base + 2s) );
+
+static_assert( std::chrono::ceil<seconds>(base + 1000ms) == (base + 1s) );
+static_assert( std::chrono::ceil<seconds>(base + 1001ms) == (base + 2s) );
+static_assert( std::chrono::ceil<seconds>(base + 1500ms) == (base + 2s) );
+static_assert( std::chrono::ceil<seconds>(base + 1999ms) == (base + 2s) );
+static_assert( std::chrono::ceil<seconds>(base + 2000ms) == (base + 2s) );
+static_assert( std::chrono::ceil<seconds>(base + 2001ms) == (base + 3s) );
+static_assert( std::chrono::ceil<seconds>(base + 2500ms) == (base + 3s) );
+
+static_assert( std::chrono::round<seconds>(base + 1000ms) == (base + 1s) );
+static_assert( std::chrono::round<seconds>(base + 1001ms) == (base + 1s) );
+static_assert( std::chrono::round<seconds>(base + 1499ms) == (base + 1s) );
+static_assert( std::chrono::round<seconds>(base + 1500ms) == (base + 2s) );
+static_assert( std::chrono::round<seconds>(base + 1999ms) == (base + 2s) );
+static_assert( std::chrono::round<seconds>(base + 2000ms) == (base + 2s) );
+static_assert( std::chrono::round<seconds>(base + 2001ms) == (base + 2s) );
+static_assert( std::chrono::round<seconds>(base + 2500ms) == (base + 2s) );
+static_assert( std::chrono::round<seconds>(base + 2501ms) == (base + 3s) );
diff --git a/libstdc++-v3/testsuite/20_util/tuple/apply/1.cc b/libstdc++-v3/testsuite/20_util/tuple/apply/1.cc
new file mode 100644
index 00000000000..c12309cd253
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/tuple/apply/1.cc
@@ -0,0 +1,67 @@
+// Copyright (C) 2014-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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+
+#include <tuple>
+#include <testsuite_hooks.h>
+
+#if __cpp_lib_apply < 201603
+# error "__cpp_lib_apply < 201603"
+#endif
+
+void
+test01()
+{
+ auto t = std::make_tuple(1, '2', 3.0);
+ std::apply( [&](int& i, char& c, double& d) {
+ VERIFY(&i == &std::get<int>(t));
+ VERIFY(&c == &std::get<char>(t));
+ VERIFY(&d == &std::get<double>(t));
+ }, t);
+}
+
+constexpr int func(int i, int j) { return i + j; }
+
+void
+test02()
+{
+ constexpr auto t = std::make_tuple(1, 2);
+ constexpr int i = std::apply(func, t);
+ VERIFY( i == 3 );
+}
+
+struct F
+{
+ int f(int i, int j) const { return i + j; }
+};
+
+void
+test03()
+{
+ auto t = std::make_tuple(F{}, 1, 2);
+ int r = std::apply(&F::f, t);
+ VERIFY( r == 3 );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+}
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/66338.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/66338.cc
index f57eae90549..8dd29b60194 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/cons/66338.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/cons/66338.cc
@@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// { dg-do compile { target c++11 } }
+
#include <tuple>
struct S {
diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc
index fe9bea678a4..a9bf9542dbf 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/cons/element_accepts_anything_byval.cc
@@ -15,6 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// { dg-do compile { target c++11 } }
+
#include <tuple>
using namespace std;
@@ -27,4 +29,3 @@ int main() {
tuple<Something> t1;
tuple<Something> t2 = t1;
}
-
diff --git a/libstdc++-v3/testsuite/20_util/tuple/element_access/get_neg.cc b/libstdc++-v3/testsuite/20_util/tuple/element_access/get_neg.cc
new file mode 100644
index 00000000000..5bcf5761c36
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/tuple/element_access/get_neg.cc
@@ -0,0 +1,61 @@
+// 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 copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-fno-show-column" }
+// { dg-do compile { target c++14 } }
+// { dg-error "in range" "" { target *-*-* } 1280 }
+
+#include <tuple>
+
+void
+test01()
+{
+ using test_type = std::tuple<>;
+ test_type t;
+ std::get<0>(t); // { dg-error "no match" }
+ std::get<0>(const_cast<const test_type&>(t)); // { dg-error "no match" }
+ std::get<0>(static_cast<test_type&&>(t)); // { dg-error "no match" }
+ std::get<5>(t); // { dg-error "no match" }
+ std::get<5>(const_cast<const test_type&>(t)); // { dg-error "no match" }
+ std::get<5>(static_cast<test_type&&>(t)); // { dg-error "no match" }
+}
+
+void
+test02()
+{
+ using test_type = std::tuple<int>;
+ test_type t;
+ std::get<1>(t); // { dg-error "no match" }
+ std::get<1>(const_cast<const test_type&>(t)); // { dg-error "no match" }
+ std::get<1>(static_cast<test_type&&>(t)); // { dg-error "no match" }
+ std::get<5>(t); // { dg-error "no match" }
+ std::get<5>(const_cast<const test_type&>(t)); // { dg-error "no match" }
+ std::get<5>(static_cast<test_type&&>(t)); // { dg-error "no match" }
+}
+
+void
+test03()
+{
+ using test_type = std::tuple<int, int, int, int>;
+ test_type t;
+ std::get<5>(t); // { dg-error "no match" }
+ std::get<5>(const_cast<const test_type&>(t)); // { dg-error "no match" }
+ std::get<5>(static_cast<test_type&&>(t)); // { dg-error "no match" }
+ std::get<6>(t); // { dg-error "no match" }
+ std::get<6>(const_cast<const test_type&>(t)); // { dg-error "no match" }
+ std::get<6>(static_cast<test_type&&>(t)); // { dg-error "no match" }
+}
diff --git a/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc b/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc
index aea73ffa3bb..124bf754fec 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/requirements/dr801.cc
@@ -36,10 +36,6 @@ void test_trivial()
// Negative
/*
- static_assert(std::has_trivial_default_constructor<tuple_type>::value,
- "! triv default");
- static_assert(std::has_trivial_copy_assign<tuple_type>::value,
- "! triv assign");
static_assert(std::is_trivial<tuple_type>::value, "! triv");
static_assert(std::is_pod<tuple_type>::value, "! pod");
*/
diff --git a/libstdc++-v3/testsuite/20_util/tuple/tuple_size_v.cc b/libstdc++-v3/testsuite/20_util/tuple/tuple_size_v.cc
new file mode 100644
index 00000000000..29ce5c1701f
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/tuple/tuple_size_v.cc
@@ -0,0 +1,33 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+// Copyright (C) 2014-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 <tuple>
+
+using namespace std;
+
+// These tests are rather simple, the front-end tests already test
+// variable templates, and the library tests for the underlying
+// traits are more elaborate. These are just simple sanity tests.
+
+static_assert(tuple_size_v<tuple<int>> == 1
+ && tuple_size<tuple<int>>::value == 1, "");
+
+static_assert(tuple_size_v<tuple<int, int>> == 2
+ && tuple_size<tuple<int, int>>::value == 2, "");
diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc
new file mode 100644
index 00000000000..cc6e790895f
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc
@@ -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>>);
diff --git a/libstdc++-v3/testsuite/20_util/variable_templates_for_traits.cc b/libstdc++-v3/testsuite/20_util/variable_templates_for_traits.cc
new file mode 100644
index 00000000000..5a497f12445
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/variable_templates_for_traits.cc
@@ -0,0 +1,344 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+// Copyright (C) 2014-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 <type_traits>
+
+using namespace std;
+
+// These tests are rather simple, the front-end tests already test
+// variable templates, and the library tests for the underlying
+// traits are more elaborate. These are just simple sanity tests.
+
+static_assert(is_void_v<void> && is_void<void>::value, "");
+static_assert(!is_void_v<int> && !is_void<int>::value, "");
+
+static_assert(is_null_pointer_v<nullptr_t>
+ && is_null_pointer<nullptr_t>::value, "");
+static_assert(!is_null_pointer_v<void*>
+ && !is_null_pointer<void*>::value, "");
+
+static_assert(is_integral_v<int> && is_integral<int>::value, "");
+static_assert(!is_integral_v<int*> && !is_integral<int*>::value, "");
+
+static_assert(is_floating_point_v<float>
+ && is_floating_point<float>::value, "");
+static_assert(!is_floating_point_v<int>
+ && !is_floating_point<int>::value, "");
+
+static_assert(is_array_v<char[42]> && is_array<char[42]>::value, "");
+static_assert(!is_array_v<char*> && !is_array<char*>::value, "");
+
+static_assert(is_pointer_v<int*> && is_pointer<int*>::value, "");
+static_assert(!is_pointer_v<int> && !is_pointer<int>::value, "");
+
+static_assert(is_lvalue_reference_v<int&>
+ && is_lvalue_reference<int&>::value, "");
+static_assert(!is_lvalue_reference_v<int>
+ && !is_lvalue_reference<int>::value, "");
+
+static_assert(is_rvalue_reference_v<int&&>
+ && is_rvalue_reference<int&&>::value, "");
+static_assert(!is_rvalue_reference_v<int>
+ && !is_rvalue_reference<int>::value, "");
+
+struct EmptyFinal final {};
+
+static_assert(is_member_object_pointer_v<int (EmptyFinal::*)>
+ && is_member_object_pointer<int (EmptyFinal::*)>::value, "");
+static_assert(!is_member_object_pointer_v<void*>
+ && !is_member_object_pointer<void*>::value, "");
+
+static_assert(is_member_function_pointer_v<int (EmptyFinal::*)()>
+ && is_member_function_pointer<int (EmptyFinal::*)()>::value, "");
+static_assert(!is_member_function_pointer_v<void*>
+ && !is_member_function_pointer<void*>::value, "");
+
+enum Enum {};
+
+static_assert(is_enum_v<Enum> && is_enum<Enum>::value, "");
+static_assert(!is_enum_v<int> && !is_enum<int>::value, "");
+
+union Union;
+
+static_assert(is_union_v<Union> && is_union<Union>::value, "");
+static_assert(!is_union_v<int> && !is_union<int>::value, "");
+
+static_assert(is_class_v<EmptyFinal> && is_class<EmptyFinal>::value, "");
+static_assert(!is_class_v<int> && !is_class<int>::value, "");
+
+static_assert(is_function_v<void()> && is_function<void()>::value, "");
+static_assert(!is_function_v<void(*)()> && !is_function<void(*)()>::value, "");
+
+static_assert(is_reference_v<int&> && is_reference<int&>::value, "");
+static_assert(!is_reference_v<int> && !is_reference<int>::value, "");
+
+static_assert(is_arithmetic_v<int> && is_arithmetic<int>::value, "");
+static_assert(!is_arithmetic_v<void*> && !is_arithmetic<void*>::value, "");
+
+static_assert(is_fundamental_v<int> && is_fundamental<int>::value, "");
+static_assert(!is_fundamental_v<EmptyFinal>
+ && !is_fundamental<EmptyFinal>::value, "");
+
+static_assert(is_object_v<int> && is_object<int>::value, "");
+static_assert(!is_object_v<int&> && !is_object<int&>::value, "");
+
+static_assert(is_scalar_v<int> && is_scalar<int>::value, "");
+static_assert(!is_scalar_v<int&> && !is_scalar<int&>::value, "");
+
+static_assert(is_compound_v<EmptyFinal>
+ && is_compound<EmptyFinal>::value, "");
+static_assert(!is_compound_v<int> && !is_compound<int>::value, "");
+
+static_assert(is_member_pointer_v<int (EmptyFinal::*)>
+ && is_member_pointer<int (EmptyFinal::*)>::value, "");
+static_assert(!is_member_pointer_v<void*>
+ && !is_member_pointer<void*>::value, "");
+
+static_assert(is_const_v<const int> && is_const<const int>::value, "");
+static_assert(!is_const_v<int> && !is_const<int>::value, "");
+
+static_assert(is_volatile_v<volatile int>
+ && is_volatile<volatile int>::value, "");
+static_assert(!is_volatile_v<int> && !is_volatile<int>::value, "");
+
+struct NType
+{
+ NType(int);
+ ~NType();
+ int i;
+private:
+ NType(const NType&);
+ NType& operator=(const NType&);
+ int i2;
+};
+
+static_assert(is_trivial_v<int> && is_trivial<int>::value, "");
+static_assert(!is_trivial_v<NType> && !is_trivial<NType>::value, "");
+
+static_assert(is_trivially_copyable_v<int>
+ && is_trivially_copyable<int>::value, "");
+static_assert(!is_trivially_copyable_v<NType>
+ && !is_trivially_copyable<NType>::value, "");
+
+static_assert(is_standard_layout_v<int>
+ && is_standard_layout<int>::value, "");
+static_assert(!is_standard_layout_v<NType>
+ && !is_standard_layout<NType>::value, "");
+
+static_assert(is_pod_v<int>
+ && is_pod<int>::value, "");
+static_assert(!is_pod_v<NType>
+ && !is_pod<NType>::value, "");
+
+static_assert(is_literal_type_v<int>
+ && is_literal_type<int>::value, "");
+static_assert(!is_literal_type_v<NType>
+ && !is_literal_type<NType>::value, "");
+
+static_assert(is_empty_v<EmptyFinal>
+ && is_empty<EmptyFinal>::value, "");
+static_assert(!is_empty_v<NType>
+ && !is_empty<NType>::value, "");
+
+struct Abstract {protected: virtual ~Abstract() = 0;};
+struct Poly : Abstract {virtual ~Poly();};
+
+static_assert(is_polymorphic_v<Poly>
+ && is_polymorphic<Poly>::value, "");
+static_assert(!is_polymorphic_v<EmptyFinal>
+ && !is_polymorphic<EmptyFinal>::value, "");
+
+
+
+static_assert(is_abstract_v<Abstract>
+ && is_abstract<Abstract>::value, "");
+static_assert(!is_abstract_v<EmptyFinal>
+ && !is_abstract<EmptyFinal>::value, "");
+
+static_assert(is_final_v<EmptyFinal>
+ && is_final<EmptyFinal>::value, "");
+static_assert(!is_final_v<Abstract>
+ && !is_final<Abstract>::value, "");
+
+static_assert(is_signed_v<int> && is_signed<int>::value, "");
+static_assert(!is_signed_v<unsigned int>
+ && !is_signed<unsigned int>::value, "");
+
+static_assert(is_constructible_v<int, int>
+ && is_constructible<int, int>::value, "");
+static_assert(!is_constructible_v<int, void*>
+ && !is_constructible<int, void*>::value, "");
+
+static_assert(is_default_constructible_v<int>
+ && is_default_constructible<int>::value, "");
+static_assert(!is_default_constructible_v<NType>
+ && !is_default_constructible<NType>::value, "");
+
+static_assert(is_copy_constructible_v<int>
+ && is_copy_constructible<int>::value, "");
+static_assert(!is_copy_constructible_v<NType>
+ && !is_copy_constructible<NType>::value, "");
+
+static_assert(is_move_constructible_v<int>
+ && is_copy_constructible<int>::value, "");
+static_assert(!is_move_constructible_v<NType>
+ && !is_copy_constructible<NType>::value, "");
+
+static_assert(is_assignable_v<int&, int>
+ && is_assignable<int&, int>::value, "");
+static_assert(!is_assignable_v<int, int>
+ && !is_assignable<int, int>::value, "");
+
+static_assert(is_copy_assignable_v<int>
+ && is_copy_assignable<int>::value, "");
+static_assert(!is_copy_assignable_v<NType>
+ && !is_copy_assignable<NType>::value, "");
+
+static_assert(is_move_assignable_v<int>
+ && is_move_assignable<int>::value, "");
+static_assert(!is_move_assignable_v<NType>
+ && !is_move_assignable<NType>::value, "");
+
+static_assert(is_destructible_v<int>
+ && is_destructible<int>::value, "");
+static_assert(!is_destructible_v<Abstract>
+ && !is_destructible<Abstract>::value, "");
+
+static_assert(is_trivially_constructible_v<int, int>
+ && is_trivially_constructible<int, int>::value, "");
+static_assert(!is_trivially_constructible_v<NType, NType>
+ && !is_trivially_constructible<NType, NType>::value, "");
+
+static_assert(is_trivially_default_constructible_v<int>
+ && is_trivially_default_constructible<int>::value, "");
+static_assert(!is_trivially_default_constructible_v<NType>
+ && !is_trivially_default_constructible<NType>::value, "");
+
+static_assert(is_trivially_copy_constructible_v<int>
+ && is_trivially_copy_constructible<int>::value, "");
+static_assert(!is_trivially_copy_constructible_v<NType>
+ && !is_trivially_copy_constructible<NType>::value, "");
+
+static_assert(is_trivially_move_constructible_v<int>
+ && is_trivially_move_constructible<int>::value, "");
+static_assert(!is_trivially_move_constructible_v<NType>
+ && !is_trivially_move_constructible<NType>::value, "");
+
+static_assert(is_trivially_assignable_v<int&, int>
+ && is_trivially_assignable<int&, int>::value, "");
+static_assert(!is_trivially_assignable_v<NType, NType>
+ && !is_trivially_assignable<NType, NType>::value, "");
+
+static_assert(is_trivially_copy_assignable_v<int>
+ && is_trivially_copy_assignable<int>::value, "");
+static_assert(!is_trivially_copy_assignable_v<NType>
+ && !is_trivially_copy_assignable<NType>::value, "");
+
+static_assert(is_trivially_move_assignable_v<int>
+ && is_trivially_move_assignable<int>::value, "");
+static_assert(!is_trivially_move_assignable_v<NType>
+ && !is_trivially_move_assignable<NType>::value, "");
+
+static_assert(is_trivially_destructible_v<int>
+ && is_trivially_destructible<int>::value, "");
+static_assert(!is_trivially_destructible_v<Abstract>
+ && !is_trivially_destructible<Abstract>::value, "");
+
+static_assert(is_nothrow_constructible_v<int, int>
+ && is_nothrow_constructible<int, int>::value, "");
+static_assert(!is_nothrow_constructible_v<NType, NType>
+ && !is_nothrow_constructible<NType, NType>::value, "");
+
+static_assert(is_nothrow_default_constructible_v<int>
+ && is_nothrow_default_constructible<int>::value, "");
+static_assert(!is_nothrow_default_constructible_v<NType>
+ && !is_nothrow_default_constructible<NType>::value, "");
+
+static_assert(is_nothrow_copy_constructible_v<int>
+ && is_nothrow_copy_constructible<int>::value, "");
+static_assert(!is_nothrow_copy_constructible_v<NType>
+ && !is_nothrow_copy_constructible<NType>::value, "");
+
+static_assert(is_nothrow_move_constructible_v<int>
+ && is_nothrow_move_constructible<int>::value, "");
+static_assert(!is_nothrow_move_constructible_v<NType>
+ && !is_nothrow_move_constructible<NType>::value, "");
+
+static_assert(is_nothrow_assignable_v<int&, int>
+ && is_nothrow_assignable<int&, int>::value, "");
+static_assert(!is_nothrow_assignable_v<NType, NType>
+ && !is_nothrow_assignable<NType, NType>::value, "");
+
+static_assert(is_nothrow_copy_assignable_v<int>
+ && is_nothrow_copy_assignable<int>::value, "");
+static_assert(!is_nothrow_copy_assignable_v<NType>
+ && !is_nothrow_copy_assignable<NType>::value, "");
+
+static_assert(is_nothrow_move_assignable_v<int>
+ && is_nothrow_move_assignable<int>::value, "");
+static_assert(!is_nothrow_move_assignable_v<NType>
+ && !is_nothrow_move_assignable<NType>::value, "");
+
+static_assert(has_virtual_destructor_v<Abstract>
+ && has_virtual_destructor<Abstract>::value, "");
+static_assert(!has_virtual_destructor_v<NType>
+ && !has_virtual_destructor<NType>::value, "");
+
+static_assert(alignment_of_v<int> == alignof(int)
+ && alignment_of<int>::value == alignof(int) , "");
+
+static_assert(rank_v<int[1][1]> == rank<int[1][1]>::value, "");
+
+static_assert(extent_v<int[1][2], 1> == 2
+ && extent<int[1][2], 1>::value == 2, "");
+
+static_assert(is_same_v<int, int> && is_same<int, int>::value, "");
+static_assert(!is_same_v<int, char> && !is_same<int, char>::value, "");
+
+static_assert(is_base_of_v<Abstract, Poly>
+ && is_base_of<Abstract, Poly>::value, "");
+static_assert(!is_base_of_v<Abstract, NType>
+ && !is_base_of<Abstract, NType>::value, "");
+
+static_assert(is_convertible_v<int&, const int&>
+ && is_convertible<int&, const int&>::value, "");
+static_assert(!is_convertible_v<const int&, int&>
+ && !is_convertible<const int&, int&>::value, "");
+
+static_assert(negation_v<false_type>, "");
+static_assert(!negation_v<true_type>, "");
+static_assert(conjunction_v<>, "");
+static_assert(!disjunction_v<>, "");
+static_assert(conjunction_v<true_type>, "");
+static_assert(!conjunction_v<false_type>, "");
+static_assert(disjunction_v<true_type>, "");
+static_assert(!disjunction_v<false_type>, "");
+static_assert(conjunction_v<true_type, true_type>, "");
+static_assert(!conjunction_v<true_type, false_type>, "");
+static_assert(disjunction_v<false_type, true_type>, "");
+static_assert(!disjunction_v<false_type, false_type>, "");
+static_assert(conjunction_v<true_type, true_type,
+ true_type>, "");
+static_assert(!conjunction_v<true_type, true_type,
+ false_type>, "");
+static_assert(disjunction_v<false_type, false_type,
+ true_type>, "");
+static_assert(!disjunction_v<false_type, false_type,
+ false_type>, "");