aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-05-03 16:12:19 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-05-03 16:12:19 +0100
commitadba76a3912e1297d337e2870bceaad19a61b6f5 (patch)
tree3997449c499a5ed135f77fe13ce1c736886b2ca0 /libstdc++-v3
parent852ee53c2775b43fef0bdba08c160ea95c1c7245 (diff)
downloadgcc-adba76a3912e1297d337e2870bceaad19a61b6f5.zip
gcc-adba76a3912e1297d337e2870bceaad19a61b6f5.tar.gz
gcc-adba76a3912e1297d337e2870bceaad19a61b6f5.tar.bz2
Add tests for std::remove_cvref
* testsuite/20_util/remove_cvref/requirements/alias_decl.cc: New. * testsuite/20_util/remove_cvref/requirements/explicit_instantiation.cc: New. * testsuite/20_util/remove_cvref/value.cc: New. * testsuite/20_util/remove_cvref/value_ext.cc: New. From-SVN: r259896
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/testsuite/20_util/remove_cvref/requirements/alias_decl.cc37
-rw-r--r--libstdc++-v3/testsuite/20_util/remove_cvref/requirements/explicit_instantiation.cc29
-rw-r--r--libstdc++-v3/testsuite/20_util/remove_cvref/value.cc50
-rw-r--r--libstdc++-v3/testsuite/20_util/remove_cvref/value_ext.cc49
5 files changed, 171 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 3b12844..f347301 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,11 @@
2018-05-03 Jonathan Wakely <jwakely@redhat.com>
+ * testsuite/20_util/remove_cvref/requirements/alias_decl.cc: New.
+ * testsuite/20_util/remove_cvref/requirements/explicit_instantiation.cc:
+ New.
+ * testsuite/20_util/remove_cvref/value.cc: New.
+ * testsuite/20_util/remove_cvref/value_ext.cc: New.
+
PR libstdc++/84087 LWG DR 2268 basic_string default arguments
* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI=1]
(append(const basic_string&, size_type, size_type)
diff --git a/libstdc++-v3/testsuite/20_util/remove_cvref/requirements/alias_decl.cc b/libstdc++-v3/testsuite/20_util/remove_cvref/requirements/alias_decl.cc
new file mode 100644
index 0000000..1b2f67f
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/remove_cvref/requirements/alias_decl.cc
@@ -0,0 +1,37 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2018 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>
+
+using namespace std;
+
+static_assert (is_same<typename remove_cvref<int>::type,
+ remove_cvref_t<int>>(),
+ "remove_cvref_t" );
+
+static_assert (is_same<typename remove_cvref<const volatile long&>::type,
+ remove_cvref_t<const volatile long&>>(),
+ "remove_cvref_t" );
+
+static_assert (is_same<typename remove_cvref<const short&&>::type,
+ remove_cvref_t<const short&&>>(),
+ "remove_cvref_t" );
diff --git a/libstdc++-v3/testsuite/20_util/remove_cvref/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/remove_cvref/requirements/explicit_instantiation.cc
new file mode 100644
index 0000000..5dac5c7
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/remove_cvref/requirements/explicit_instantiation.cc
@@ -0,0 +1,29 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2018 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
+{
+ typedef short test_type;
+ template struct remove_cvref<test_type>;
+}
diff --git a/libstdc++-v3/testsuite/20_util/remove_cvref/value.cc b/libstdc++-v3/testsuite/20_util/remove_cvref/value.cc
new file mode 100644
index 0000000..534464c
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/remove_cvref/value.cc
@@ -0,0 +1,50 @@
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+
+// Copyright (C) 2018 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::remove_cvref;
+ using std::is_same;
+ using namespace __gnu_test;
+
+ static_assert(is_same<remove_cvref<const volatile int>::type,
+ int>::value, "");
+ static_assert(is_same<remove_cvref<const volatile int*>::type,
+ const volatile int*>::value, "");
+ static_assert(is_same<typename remove_cvref<const volatile int&>::type,
+ int>::value, "");
+ static_assert(is_same<typename remove_cvref<const volatile int&&>::type,
+ int>::value, "");
+ static_assert(is_same<remove_cvref<const volatile ClassType>::type,
+ ClassType>::value, "");
+ static_assert(is_same<remove_cvref<const volatile ClassType*>::type,
+ const volatile ClassType*>::value, "");
+ static_assert(is_same<typename remove_cvref<const volatile ClassType&>::type,
+ ClassType>::value, "");
+ static_assert(is_same<typename remove_cvref<const volatile ClassType&&>::type,
+ ClassType>::value, "");
+ static_assert(is_same<typename remove_cvref<const int(&)[3]>::type,
+ int[3]>::value, "");
+ static_assert(is_same<typename remove_cvref<const int(&)()>::type,
+ const int()>::value, "");
+}
diff --git a/libstdc++-v3/testsuite/20_util/remove_cvref/value_ext.cc b/libstdc++-v3/testsuite/20_util/remove_cvref/value_ext.cc
new file mode 100644
index 0000000..9790b95
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/remove_cvref/value_ext.cc
@@ -0,0 +1,49 @@
+// { dg-do compile { target c++11 } }
+
+// Copyright (C) 2018 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::__remove_cvref_t;
+ using std::is_same;
+ using namespace __gnu_test;
+
+ static_assert(is_same<__remove_cvref_t<const volatile int>,
+ int>::value, "");
+ static_assert(is_same<__remove_cvref_t<const volatile int*>,
+ const volatile int*>::value, "");
+ static_assert(is_same<__remove_cvref_t<const volatile int&>,
+ int>::value, "");
+ static_assert(is_same<__remove_cvref_t<const volatile int&&>,
+ int>::value, "");
+ static_assert(is_same<__remove_cvref_t<const volatile ClassType>,
+ ClassType>::value, "");
+ static_assert(is_same<__remove_cvref_t<const volatile ClassType*>,
+ const volatile ClassType*>::value, "");
+ static_assert(is_same<__remove_cvref_t<const volatile ClassType&>,
+ ClassType>::value, "");
+ static_assert(is_same<__remove_cvref_t<const volatile ClassType&&>,
+ ClassType>::value, "");
+ static_assert(is_same<__remove_cvref_t<const int(&)[3]>,
+ int[3]>::value, "");
+ static_assert(is_same<__remove_cvref_t<const int(&)()>,
+ const int()>::value, "");
+}