Implement delayed parsing for member function templates. Fixes PR4608.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79709 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
index 439afa8..50d31fb 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.conv/p4.cpp
@@ -11,36 +11,32 @@
 
 struct AnyThreeLevelPtr {
   template<typename T>
-  operator T***() const;
-  // FIXME: Can't handle definitions of member templates yet
-#if 0
+  operator T***() const
   {
     T x = 0;
-    x = 0; // will fail if T is deduced to a const type
+    // FIXME: looks like we get this wrong, too!
+    // x = 0; // will fail if T is deduced to a const type
            // (EDG and GCC get this wrong)
     return 0;
   }
-#endif
 };
 
+struct X { };
+
 void test_deduce_with_qual(AnyThreeLevelPtr a3) {
   int * const * const * const ip = a3;
 }
 
-struct X { };
-
 struct AnyPtrMem {
   template<typename Class, typename T>
-  operator T Class::*() const;
-  // FIXME: Can't handle definitions of member templates yet
-#if 0
+  operator T Class::*() const
   {
     T x = 0;
-    x = 0; // will fail if T is deduced to a const type.
+    // FIXME: looks like we get this wrong, too!
+    // x = 0; // will fail if T is deduced to a const type.
            // (EDG and GCC get this wrong)
     return 0;
   }
-#endif
 };
 
 void test_deduce_ptrmem_with_qual(AnyPtrMem apm) {
diff --git a/test/SemaTemplate/member-function-template.cpp b/test/SemaTemplate/member-function-template.cpp
index 217a67a..91eb53b 100644
--- a/test/SemaTemplate/member-function-template.cpp
+++ b/test/SemaTemplate/member-function-template.cpp
@@ -39,3 +39,6 @@
   float& (X::*pm2)(float) = &X::f1;
   int& (X::*pm3)(float, int) = &X::f1;
 }
+
+// PR4608
+class A { template <class x> x a(x z) { return z+y; } int y; };