add_cv.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// type_traits 11 12// add_cv 13 14#include <type_traits> 15 16template <class T, class U> 17void test_add_cv_imp() 18{ 19 static_assert((std::is_same<typename std::add_cv<T>::type, const volatile U>::value), ""); 20} 21 22template <class T> 23void test_add_cv() 24{ 25 test_add_cv_imp<T, const volatile T>(); 26 test_add_cv_imp<const T, const volatile T>(); 27 test_add_cv_imp<volatile T, volatile const T>(); 28 test_add_cv_imp<const volatile T, const volatile T>(); 29} 30 31int main() 32{ 33 test_add_cv<void>(); 34 test_add_cv<int>(); 35 test_add_cv<int[3]>(); 36 test_add_cv<int&>(); 37 test_add_cv<const int&>(); 38 test_add_cv<int*>(); 39 test_add_cv<const int*>(); 40} 41