summaryrefslogtreecommitdiffstats
path: root/test/SemaTemplate/temp_class_spec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaTemplate/temp_class_spec.cpp')
-rw-r--r--test/SemaTemplate/temp_class_spec.cpp75
1 files changed, 72 insertions, 3 deletions
diff --git a/test/SemaTemplate/temp_class_spec.cpp b/test/SemaTemplate/temp_class_spec.cpp
index 1a53423..dad857e 100644
--- a/test/SemaTemplate/temp_class_spec.cpp
+++ b/test/SemaTemplate/temp_class_spec.cpp
@@ -16,8 +16,7 @@ struct is_pointer<const T*> {
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}}
+int array2[is_pointer<const int*>::value? 1 : -1];
template<typename T>
struct is_lvalue_reference {
@@ -32,6 +31,38 @@ struct is_lvalue_reference<T&> {
int lvalue_ref0[is_lvalue_reference<int>::value? -1 : 1];
int lvalue_ref1[is_lvalue_reference<const int&>::value? 1 : -1];
+template<typename T>
+struct is_const {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_const<const T> {
+ static const bool value = true;
+};
+
+int is_const0[is_const<int>::value? -1 : 1];
+int is_const1[is_const<const int>::value? 1 : -1];
+int is_const2[is_const<const volatile int>::value? 1 : -1];
+int is_const3[is_const<const int [3]>::value? 1 : -1];
+int is_const4[is_const<const volatile int[3]>::value? 1 : -1];
+int is_const5[is_const<volatile int[3]>::value? -1 : 1];
+
+template<typename T>
+struct is_volatile {
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_volatile<volatile T> {
+ static const bool value = true;
+};
+
+int is_volatile0[is_volatile<int>::value? -1 : 1];
+int is_volatile1[is_volatile<volatile int>::value? 1 : -1];
+int is_volatile2[is_volatile<const volatile int>::value? 1 : -1];
+int is_volatile3[is_volatile<volatile char[3]>::value? 1 : -1];
+
template<typename T, typename U>
struct is_same {
static const bool value = false;
@@ -62,7 +93,20 @@ struct remove_reference<T&> {
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 remove_const {
+ typedef T type;
+};
+
+template<typename T>
+struct remove_const<const T> {
+ typedef T type;
+};
+
+int remove_const0[is_same<remove_const<const int>::type, int>::value? 1 : -1];
+int remove_const1[is_same<remove_const<const int[3]>::type, int[3]>::value? 1 : -1];
+
template<typename T>
struct is_incomplete_array {
static const bool value = false;
@@ -104,6 +148,24 @@ struct get_array_size<T[N]> {
int array_size0[get_array_size<int[12]>::value == 12? 1 : -1];
template<typename T>
+struct remove_extent {
+ typedef T type;
+};
+
+template<typename T>
+struct remove_extent<T[]> {
+ typedef T type;
+};
+
+template<typename T, unsigned N>
+struct remove_extent<T[N]> {
+ typedef T type;
+};
+
+int remove_extent0[is_same<remove_extent<int[][5]>::type, int[5]>::value? 1 : -1];
+int remove_extent1[is_same<remove_extent<const int[][5]>::type, const int[5]>::value? 1 : -1];
+
+template<typename T>
struct is_unary_function {
static const bool value = false;
};
@@ -261,3 +323,10 @@ template<class T, int I> class A<T, T*, I> { }; //#2
template<class T1, class T2, int I> class A<T1*, T2, I> { }; //#3
template<class T> class A<int, T*, 5> { }; //#4
template<class T1, class T2, int I> class A<T1, T2*, I> { }; //#5
+
+// Redefinition of class template partial specializations
+template<typename T, T N, typename U> class A0;
+
+template<typename T, T N> class A0<T, N, int> { }; // expected-note{{here}}
+template<typename T, T N> class A0<T, N, int>;
+template<typename T, T N> class A0<T, N, int> { }; // expected-error{{redef}}
OpenPOWER on IntegriCloud