More cleanup of template argument deduction and its handling of
non-CVR qualifiers. We can now properly match address-space--qualified
references during template argument deduction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130365 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/address-spaces.cpp b/test/SemaTemplate/address-spaces.cpp
index 26e7224..df262e1 100644
--- a/test/SemaTemplate/address-spaces.cpp
+++ b/test/SemaTemplate/address-spaces.cpp
@@ -31,7 +31,21 @@
 int check_remove1[is_same<remove_pointer<int_2_ptr>::type, int_2>::value? 1 : -1];
 int check_remove2[is_same<remove_pointer<int_2_ptr>::type, int>::value? -1 : 1];
 int check_remove3[is_same<remove_pointer<int_2_ptr>::type, int_1>::value? -1 : 1];
+
+template<typename T>
+struct is_pointer_in_address_space_1 {
+  static const bool value = false;
+};
+
+template<typename T>
+struct is_pointer_in_address_space_1<T __attribute__((address_space(1))) *> {
+  static const bool value = true;
+};
                 
+int check_ptr_in_as1[is_pointer_in_address_space_1<int_1_ptr>::value? 1 : -1];
+int check_ptr_in_as2[is_pointer_in_address_space_1<int_2_ptr>::value? -1 : 1];
+int check_ptr_in_as3[is_pointer_in_address_space_1<int*>::value? -1 : 1];
+
 // Check that we maintain address spaces through template argument
 // deduction for a call.
 template<typename T>
@@ -46,3 +60,16 @@
   accept_any_pointer(array); // expected-note{{in instantiation of}}
 }
 
+template<typename T> struct identity {};
+
+template<typename T>
+identity<T> accept_arg_in_address_space_1(__attribute__((address_space(1))) T &ir1);
+
+template<typename T>
+identity<T> accept_any_arg(T &ir1);
+
+void test_arg_in_address_space_1() {
+  static int __attribute__((address_space(1))) int_1;
+  identity<int> ii = accept_arg_in_address_space_1(int_1);
+  identity<int __attribute__((address_space(1)))> ii2 = accept_any_arg(int_1);
+}