blob: cf32196213e166e5b6449e828516f86e47e3f482 [file] [log] [blame]
Marshall Clowebd6c2b2014-03-05 03:39:25 +00001//===----------------------------------------------------------------------===//
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// is_final
13
14#include <type_traits>
15
Marshall Clow24b29a02014-03-05 17:58:48 +000016#if _LIBCPP_STD_VER > 11
Marshall Clowebd6c2b2014-03-05 03:39:25 +000017
18struct P final { };
19union U1 { };
20union U2 final { };
21
22template <class T>
23void test_is_final()
24{
25 static_assert( std::is_final<T>::value, "");
26 static_assert( std::is_final<const T>::value, "");
27 static_assert( std::is_final<volatile T>::value, "");
28 static_assert( std::is_final<const volatile T>::value, "");
29}
30
31template <class T>
32void test_is_not_final()
33{
34 static_assert(!std::is_final<T>::value, "");
35 static_assert(!std::is_final<const T>::value, "");
36 static_assert(!std::is_final<volatile T>::value, "");
37 static_assert(!std::is_final<const volatile T>::value, "");
Marshall Clowebd6c2b2014-03-05 03:39:25 +000038}
39
40int main ()
41{
42 test_is_not_final<int>();
43 test_is_not_final<int*>();
44 test_is_final <P>();
45 test_is_not_final<P*>();
46 test_is_not_final<U1>();
47 test_is_not_final<U1*>();
48 test_is_final <U2>();
49 test_is_not_final<U2*>();
50}
51#else
52int main () {}
53#endif