blob: f6805bc1c4ff6291e3d2d181ad3301a2208eb058 [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// is_volatile
13
14#include <type_traits>
15
16template <class T>
17void test_is_volatile()
18{
19 static_assert(!std::is_volatile<T>::value, "");
20 static_assert(!std::is_volatile<const T>::value, "");
21 static_assert( std::is_volatile<volatile T>::value, "");
22 static_assert( std::is_volatile<const volatile T>::value, "");
23}
24
25int main()
26{
27 test_is_volatile<void>();
28 test_is_volatile<int>();
29 test_is_volatile<double>();
30 test_is_volatile<int*>();
31 test_is_volatile<const int*>();
32 test_is_volatile<char[3]>();
Marshall Clowe33e03e2014-09-02 16:19:38 +000033 test_is_volatile<char[]>();
Howard Hinnantc52f43e2010-08-22 00:59:46 +000034
35 static_assert(!std::is_volatile<int&>::value, "");
36 static_assert(!std::is_volatile<volatile int&>::value, "");
37}