Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // type_traits |
| 11 | |
| 12 | // is_literal_type |
| 13 | |
| 14 | #include <type_traits> |
| 15 | |
Marshall Clow | 933afa9 | 2013-07-04 00:10:01 +0000 | [diff] [blame] | 16 | template <class T> |
| 17 | void test_is_literal_type() |
| 18 | { |
| 19 | static_assert( std::is_literal_type<T>::value, ""); |
| 20 | } |
| 21 | |
| 22 | template <class T> |
| 23 | void test_is_not_literal_type() |
| 24 | { |
| 25 | static_assert(!std::is_literal_type<T>::value, ""); |
| 26 | } |
| 27 | |
Dan Albert | 1d4a1ed | 2016-05-25 22:36:09 -0700 | [diff] [blame^] | 28 | struct A |
Howard Hinnant | 6063ec1 | 2011-05-13 14:08:16 +0000 | [diff] [blame] | 29 | { |
| 30 | }; |
| 31 | |
Dan Albert | 1d4a1ed | 2016-05-25 22:36:09 -0700 | [diff] [blame^] | 32 | struct B |
Howard Hinnant | 6063ec1 | 2011-05-13 14:08:16 +0000 | [diff] [blame] | 33 | { |
Dan Albert | 1d4a1ed | 2016-05-25 22:36:09 -0700 | [diff] [blame^] | 34 | B(); |
Howard Hinnant | 6063ec1 | 2011-05-13 14:08:16 +0000 | [diff] [blame] | 35 | }; |
| 36 | |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 37 | int main() |
| 38 | { |
Dan Albert | 1d4a1ed | 2016-05-25 22:36:09 -0700 | [diff] [blame^] | 39 | test_is_literal_type<int> (); |
| 40 | test_is_literal_type<const int> (); |
| 41 | test_is_literal_type<int&> (); |
| 42 | test_is_literal_type<volatile int&> (); |
| 43 | test_is_literal_type<A> (); |
Marshall Clow | 933afa9 | 2013-07-04 00:10:01 +0000 | [diff] [blame] | 44 | |
Dan Albert | 1d4a1ed | 2016-05-25 22:36:09 -0700 | [diff] [blame^] | 45 | test_is_not_literal_type<B> (); |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 46 | } |