summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2018-08-02 01:56:02 +0000
committerMarshall Clow <mclow.lists@gmail.com>2018-08-02 01:56:02 +0000
commitcf49ccd0e51c2019325908e18e0ae63e05c14cad (patch)
treea1632a627ce509c21d242bafa7a5aea1b1d24bb2 /libcxx/test/std/utilities
parentb9a7b7a84d35fc13c2f49d81c3353dd58f12ee03 (diff)
downloadbcm5719-llvm-cf49ccd0e51c2019325908e18e0ae63e05c14cad.tar.gz
bcm5719-llvm-cf49ccd0e51c2019325908e18e0ae63e05c14cad.zip
Implement P0887: The identity metafunction
llvm-svn: 338666
Diffstat (limited to 'libcxx/test/std/utilities')
-rw-r--r--libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp
new file mode 100644
index 00000000000..079986685a1
--- /dev/null
+++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/type_identity.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+
+// type_traits
+
+// type_identity
+
+#include <type_traits>
+
+#include "test_macros.h"
+
+template <class T>
+void test_type_identity()
+{
+ static_assert((std::is_same<typename std::type_identity<T>::type, T>::value), "");
+ static_assert((std::is_same< std::type_identity_t<T>, T>::value), "");
+}
+
+int main()
+{
+ test_type_identity<void>();
+ test_type_identity<int>();
+ test_type_identity<const volatile int>();
+ test_type_identity<int*>();
+ test_type_identity< int[3]>();
+ test_type_identity<const int[3]>();
+
+ test_type_identity<void (*)()>();
+ test_type_identity<int(int) const>();
+ test_type_identity<int(int) volatile>();
+ test_type_identity<int(int) &>();
+ test_type_identity<int(int) &&>();
+}
OpenPOWER on IntegriCloud