Home | History | Annotate | Download | only in meta.trans.cv
      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 
     16 #include "test_macros.h"
     17 
     18 template <class T, class U>
     19 void test_add_cv_imp()
     20 {
     21     static_assert((std::is_same<typename std::add_cv<T>::type, const volatile U>::value), "");
     22 #if TEST_STD_VER > 11
     23     static_assert((std::is_same<std::add_cv_t<T>, U>::value), "");
     24 #endif
     25 }
     26 
     27 template <class T>
     28 void test_add_cv()
     29 {
     30     test_add_cv_imp<T, const volatile T>();
     31     test_add_cv_imp<const T, const volatile T>();
     32     test_add_cv_imp<volatile T, volatile const T>();
     33     test_add_cv_imp<const volatile T, const volatile T>();
     34 }
     35 
     36 int main()
     37 {
     38     test_add_cv<void>();
     39     test_add_cv<int>();
     40     test_add_cv<int[3]>();
     41     test_add_cv<int&>();
     42     test_add_cv<const int&>();
     43     test_add_cv<int*>();
     44     test_add_cv<const int*>();
     45 }
     46