aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/temp_class_spec.cpp
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2009-06-06 08:21:31 +0000
committerEd Schouten <ed@FreeBSD.org>2009-06-06 08:21:31 +0000
commit37f6c480c696a4a72c1701ee54624cc807aa80ba (patch)
tree06d57bb7679a2140aef96db7105a0bd5f16a4358 /test/SemaTemplate/temp_class_spec.cpp
parent2659aeb5e51fe27d24bbffad0d1851b39fed5e43 (diff)
downloadsrc-37f6c480c696a4a72c1701ee54624cc807aa80ba.tar.gz
src-37f6c480c696a4a72c1701ee54624cc807aa80ba.zip
Import clang, at r72995.vendor/clang/clang-r72995
Notes
Notes: svn path=/vendor/clang/dist/; revision=193576 svn path=/vendor/clang/clang-r72995/; revision=193577; tag=vendor/clang/clang-r72995
Diffstat (limited to 'test/SemaTemplate/temp_class_spec.cpp')
-rw-r--r--test/SemaTemplate/temp_class_spec.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/test/SemaTemplate/temp_class_spec.cpp b/test/SemaTemplate/temp_class_spec.cpp
index df652b5ba38d..8cb46cf98f84 100644
--- a/test/SemaTemplate/temp_class_spec.cpp
+++ b/test/SemaTemplate/temp_class_spec.cpp
@@ -18,3 +18,87 @@ int array0[is_pointer<int>::value? -1 : 1];
int array1[is_pointer<int*>::value? 1 : -1];
int array2[is_pointer<const int*>::value? 1 : -1]; // expected-error{{partial ordering}} \
// expected-error{{negative}}
+
+template<typename T>
+struct is_lvalue_reference {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_lvalue_reference<T&> {
+ static const bool value = true;
+};
+
+int lvalue_ref0[is_lvalue_reference<int>::value? -1 : 1];
+int lvalue_ref1[is_lvalue_reference<const int&>::value? 1 : -1];
+
+template<typename T, typename U>
+struct is_same {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_same<T, T> {
+ static const bool value = true;
+};
+
+typedef int INT;
+typedef INT* int_ptr;
+
+int is_same0[is_same<int, int>::value? 1 : -1];
+int is_same1[is_same<int, INT>::value? 1 : -1];
+int is_same2[is_same<const int, int>::value? -1 : 1];
+int is_same3[is_same<int_ptr, int>::value? -1 : 1];
+
+template<typename T>
+struct remove_reference {
+ typedef T type;
+};
+
+template<typename T>
+struct remove_reference<T&> {
+ typedef T type;
+};
+
+int remove_ref0[is_same<remove_reference<int>::type, int>::value? 1 : -1];
+int remove_ref1[is_same<remove_reference<int&>::type, int>::value? 1 : -1];
+
+template<typename T>
+struct is_incomplete_array {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_incomplete_array<T[]> {
+ static const bool value = true;
+};
+
+int incomplete_array0[is_incomplete_array<int>::value ? -1 : 1];
+int incomplete_array1[is_incomplete_array<int[1]>::value ? -1 : 1];
+int incomplete_array2[is_incomplete_array<bool[]>::value ? 1 : -1];
+int incomplete_array3[is_incomplete_array<int[]>::value ? 1 : -1];
+
+template<typename T>
+struct is_array_with_4_elements {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_array_with_4_elements<T[4]> {
+ static const bool value = true;
+};
+
+int array_with_4_elements0[is_array_with_4_elements<int[]>::value ? -1 : 1];
+int array_with_4_elements1[is_array_with_4_elements<int[1]>::value ? -1 : 1];
+int array_with_4_elements2[is_array_with_4_elements<int[4]>::value ? 1 : -1];
+int array_with_4_elements3[is_array_with_4_elements<int[4][2]>::value ? 1 : -1];
+
+template<typename T>
+struct get_array_size;
+
+template<typename T, unsigned N>
+struct get_array_size<T[N]> {
+ static const unsigned value = N;
+};
+
+int array_size0[get_array_size<int[12]>::value == 12? 1 : -1];