blob: ce781cd936b02026132227851412644dfe61ac60 [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_literal_type
13
14#include <type_traits>
15
Marshall Clow933afa92013-07-04 00:10:01 +000016template <class T>
17void test_is_literal_type()
18{
19 static_assert( std::is_literal_type<T>::value, "");
20}
21
22template <class T>
23void test_is_not_literal_type()
24{
25 static_assert(!std::is_literal_type<T>::value, "");
26}
27
Dan Albert1d4a1ed2016-05-25 22:36:09 -070028struct A
Howard Hinnant6063ec12011-05-13 14:08:16 +000029{
30};
31
Dan Albert1d4a1ed2016-05-25 22:36:09 -070032struct B
Howard Hinnant6063ec12011-05-13 14:08:16 +000033{
Dan Albert1d4a1ed2016-05-25 22:36:09 -070034 B();
Howard Hinnant6063ec12011-05-13 14:08:16 +000035};
36
Howard Hinnantc52f43e2010-08-22 00:59:46 +000037int main()
38{
Dan Albert1d4a1ed2016-05-25 22:36:09 -070039 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 Clow933afa92013-07-04 00:10:01 +000044
Dan Albert1d4a1ed2016-05-25 22:36:09 -070045 test_is_not_literal_type<B> ();
Howard Hinnantc52f43e2010-08-22 00:59:46 +000046}