Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / meta / meta.unary / meta.unary.prop / is_volatile.pass.cpp
blobcb0fc3c6ea8a2bf3557bea5073926a473806804a
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // type_traits
11 // is_volatile
13 #include <type_traits>
14 #include "test_macros.h"
16 template <class T>
17 void test_is_volatile()
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 #if TEST_STD_VER > 14
24 static_assert(!std::is_volatile_v<T>, "");
25 static_assert(!std::is_volatile_v<const T>, "");
26 static_assert( std::is_volatile_v<volatile T>, "");
27 static_assert( std::is_volatile_v<const volatile T>, "");
28 #endif
31 struct A; // incomplete
33 int main(int, char**)
35 test_is_volatile<void>();
36 test_is_volatile<int>();
37 test_is_volatile<double>();
38 test_is_volatile<int*>();
39 test_is_volatile<const int*>();
40 test_is_volatile<char[3]>();
41 test_is_volatile<char[]>();
43 test_is_volatile<A>();
45 static_assert(!std::is_volatile<int&>::value, "");
46 static_assert(!std::is_volatile<volatile int&>::value, "");
48 return 0;