summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/20_util/type_identity/requirements/alias_decl.cc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-07-02 22:05:08 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-07-02 22:05:08 +0100
commitee896276f6483832d45c9280915367c825c32098 (patch)
tree107fdf2482d18e2dad783a2337526e15a89460c4 /libstdc++-v3/testsuite/20_util/type_identity/requirements/alias_decl.cc
parente112d53acae3d4ce8783d8fd5f396cc45443c010 (diff)
downloadgcc-ee896276f6483832d45c9280915367c825c32098.tar.gz
P0887R1 The identity metafunction
* include/std/type_traits (type_identity, type_identity_t): Define for C++2a. * testsuite/20_util/type_identity/requirements/alias_decl.cc: New. * testsuite/20_util/type_identity/requirements/ explicit_instantiation.cc:New. * testsuite/20_util/type_identity/requirements/typedefs.cc: New. From-SVN: r262319
Diffstat (limited to 'libstdc++-v3/testsuite/20_util/type_identity/requirements/alias_decl.cc')
-rw-r--r--libstdc++-v3/testsuite/20_util/type_identity/requirements/alias_decl.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/20_util/type_identity/requirements/alias_decl.cc b/libstdc++-v3/testsuite/20_util/type_identity/requirements/alias_decl.cc
new file mode 100644
index 00000000000..6729d118273
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/type_identity/requirements/alias_decl.cc
@@ -0,0 +1,35 @@
+// 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/>.
+
+// { dg-options "-std=gnu++2a" }
+// { dg-do compile { target c++2a } }
+//
+#include <type_traits>
+
+using namespace std;
+
+template<typename T, typename = std::type_identity_t<T>>
+ struct test; // undefined
+
+template<typename T>
+ struct test<T, T> : std::true_type { };
+
+static_assert( test<const int>{}, "type_identity_t<const int>" );
+static_assert( test<volatile int>{}, "type_identity_t<volatile int>" );
+static_assert( test<unsigned>{}, "type_identity_t<unsigned>" );
+static_assert( test<char>{}, "type_identity_t<char>" );
+static_assert( test<signed char>{}, "type_identity_t<signed char>" );