summaryrefslogtreecommitdiff
path: root/test/SemaTemplate/temp_class_spec.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-06-04 00:03:07 +0000
committerDouglas Gregor <dgregor@apple.com>2009-06-04 00:03:07 +0000
commit0b9247f129401b4849682b2e2bcdea8fc977068a (patch)
tree314c6302be05a3c25f5da20651be20f7b6521117 /test/SemaTemplate/temp_class_spec.cpp
parentf4d5953135c703d5f377d04b7f15c5cd337b58eb (diff)
downloadclang-0b9247f129401b4849682b2e2bcdea8fc977068a.tar.gz
When performing template argument deduction, ensure that multiple
deductions of the same template parameter are equivalent. This allows us to implement the is_same type trait (!). Also, move template argument deduction into its own file and update a few build systems with this change (grrrr). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72819 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/temp_class_spec.cpp')
-rw-r--r--test/SemaTemplate/temp_class_spec.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/SemaTemplate/temp_class_spec.cpp b/test/SemaTemplate/temp_class_spec.cpp
index df652b5ba3..1efb364a1b 100644
--- a/test/SemaTemplate/temp_class_spec.cpp
+++ b/test/SemaTemplate/temp_class_spec.cpp
@@ -18,3 +18,21 @@ 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, 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];