When forming a function call or message send expression, be sure to
strip cv-qualifiers from the expression's type when the language calls
for it: in C, that's all the time, while C++ only does it for
non-class types. 

Centralized the computation of the call expression type in
QualType::getCallResultType() and some helper functions in other nodes
(FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant
callers of getResultType() to getCallResultType().

Fixes PR7598 and PR7463, along with a bunch of getResultType() call
sites that weren't stripping references off the result type (nothing
stripped cv-qualifiers properly before this change).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108234 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/deduction.cpp b/test/SemaTemplate/deduction.cpp
index 8d00bb7..25ffb67 100644
--- a/test/SemaTemplate/deduction.cpp
+++ b/test/SemaTemplate/deduction.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
 
 // Template argument deduction with template template parameters.
 template<typename T, template<T> class A> 
@@ -98,3 +98,10 @@
   void f(const X<A>& a);
   void test(A& a) { (void)f(a); }
 }
+
+// PR7463
+namespace PR7463 {
+  const int f (); // expected-warning{{type qualifier on return type has no effect}}
+  template <typename T_> void g (T_&); // expected-note{{T_ = int}}
+  void h (void) { g(f()); } // expected-error{{no matching function for call}}
+}