blob: 76d0f12d03fb5b9b8644377ac0cfffe28247903d [file] [log] [blame]
Howard Hinnantc52f43e2010-08-22 00:59:46 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantc52f43e2010-08-22 00:59:46 +00007//
8//===----------------------------------------------------------------------===//
9
10// type_traits
11
12// add_pointer
13
14#include <type_traits>
15
16template <class T, class U>
17void test_add_pointer()
18{
19 static_assert((std::is_same<typename std::add_pointer<T>::type, U>::value), "");
Dan Albert1d4a1ed2016-05-25 22:36:09 -070020#if _LIBCPP_STD_VER > 11
Marshall Clow933afa92013-07-04 00:10:01 +000021 static_assert((std::is_same<std::add_pointer_t<T>, U>::value), "");
22#endif
Howard Hinnantc52f43e2010-08-22 00:59:46 +000023}
24
25int main()
26{
27 test_add_pointer<void, void*>();
28 test_add_pointer<int, int*>();
29 test_add_pointer<int[3], int(*)[3]>();
30 test_add_pointer<int&, int*>();
31 test_add_pointer<const int&, const int*>();
32 test_add_pointer<int*, int**>();
33 test_add_pointer<const int*, const int**>();
34}