[microsoft] Fix a bug in -fdelayed-template-parsing mode where we were not reentering the delayed function context correctly. The problem was that all template params were reintroduced inside the same scope. So if we had a situation where we had 2 template params with the same name at different scope then clang would generate an error about ambiguous name.

The solution is to create a new ParseScope(Scope::TemplateParamScope) for each template scope that we want to reenter. (from the outmost to the innermost scope)

This fixes some errors when parsing MFC code with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140344 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Parser/DelayedTemplateParsing.cpp b/test/Parser/DelayedTemplateParsing.cpp
index b447fff..b02c402 100644
--- a/test/Parser/DelayedTemplateParsing.cpp
+++ b/test/Parser/DelayedTemplateParsing.cpp
@@ -1,11 +1,11 @@
-// RUN: %clang_cc1 -fdelayed-template-parsing -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s
 
 template <class T>
 class A {
    void foo() {
        undeclared();
    }
-      void foo2();
+   void foo2();
 };
 
 template <class T>
@@ -40,3 +40,22 @@
 
 template <class T> void foo5() {} //expected-note {{previous definition is here}} 
 template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}}
+
+              
+
+namespace Inner_Outer_same_template_param_name {              
+
+template <class T>
+class Outmost {
+public:
+    template <class T>
+    class Inner {
+    public:
+        void f() {
+            T* var;
+        }
+   };
+};
+
+}
+