diff options
Diffstat (limited to 'libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp')
| -rw-r--r-- | libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp index 4ecfcb8930d..f49a2b7092a 100644 --- a/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp +++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.cv/remove_const.pass.cpp @@ -1 +1,40 @@ -//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// type_traits
// remove_const
#include <type_traits>
template <class T, class U>
void test_remove_const_imp()
{
static_assert((std::is_same<typename std::remove_const<T>::type, U>::value), "");
}
template <class T>
void test_remove_const()
{
test_remove_const_imp<T, T>();
test_remove_const_imp<const T, T>();
test_remove_const_imp<volatile T, volatile T>();
test_remove_const_imp<const volatile T, volatile T>();
}
int main()
{
test_remove_const<void>();
test_remove_const<int>();
test_remove_const<int[3]>();
test_remove_const<int&>();
test_remove_const<const int&>();
test_remove_const<int*>();
test_remove_const<const int*>();
}
\ No newline at end of file +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// type_traits + +// remove_const + +#include <type_traits> + +template <class T, class U> +void test_remove_const_imp() +{ + static_assert((std::is_same<typename std::remove_const<T>::type, U>::value), ""); +} + +template <class T> +void test_remove_const() +{ + test_remove_const_imp<T, T>(); + test_remove_const_imp<const T, T>(); + test_remove_const_imp<volatile T, volatile T>(); + test_remove_const_imp<const volatile T, volatile T>(); +} + +int main() +{ + test_remove_const<void>(); + test_remove_const<int>(); + test_remove_const<int[3]>(); + test_remove_const<int&>(); + test_remove_const<const int&>(); + test_remove_const<int*>(); + test_remove_const<const int*>(); +} |

