From 697ec700373ef8a6afc9d07236f23a2f32ddf87c Mon Sep 17 00:00:00 2001
From: Nikolai Kosjar <nikolai.kosjar@digia.com>
Date: Tue, 8 Apr 2014 09:11:10 -0400
Subject: [PATCH] Revert "C++: nested class with enclosing template class"

This reverts commit 5d76b4339a717cd944c4a3c27eac860b8111d645 since it
might lead to an infinite loop.

Task-number: QTCREATORBUG-11999
Change-Id: I12c7f3afc4aa53a83ddc2bf2d33eb76c29b747ee
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
---
 src/libs/cplusplus/LookupContext.cpp                  |  1 -
 .../followsymbol_switchmethoddecldef_test.cpp         | 11 +++++++++++
 src/plugins/cpptools/cppcompletion_test.cpp           |  2 ++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index b80ca122bdf..05f5900edc3 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -1268,7 +1268,6 @@ void ClassOrNamespace::NestedClassInstantiator::instantiate(ClassOrNamespace *en
             }
         }
 
-        nestedClassOrNamespaceInstantiation->_parent = enclosingTemplateClassInstantiation;
         instantiate(nestedClassOrNamespace, nestedClassOrNamespaceInstantiation);
 
         enclosingTemplateClassInstantiation->_classOrNamespaces[nestedName] =
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index d3947b478c9..fd369efce90 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -901,6 +901,17 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_data()
         "    void foo();\n"
         "};\n"
     );
+
+    QTest::newRow("infiniteLoopLocalTypedef_QTCREATORBUG-11999") << _(
+        "template<class MyTree>\n"
+        "class TreeConstIterator\n"
+        "{\n"
+        "    typedef TreeConstIterator<MyTree> MyIter;\n"
+        "    void f() { return this->@$g(); }\n"
+        "};\n"
+        "\n"
+        "void h() { typedef TreeConstIterator<MyBase> const_iterator; }\n"
+    );
 }
 
 void CppEditorPlugin::test_FollowSymbolUnderCursor()
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index 2b729b254f0..8679d3120a1 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -304,6 +304,8 @@ void CppToolsPlugin::test_completion()
     expectedCompletions.sort();
 
     QEXPECT_FAIL("enum_in_function_in_struct_in_function", "doesn't work", Abort);
+    QEXPECT_FAIL("nested_class_in_template_class_QTCREATORBUG-11752",
+                 "related to infiniteLoopLocalTypedef_QTCREATORBUG-11999", Abort);
     QCOMPARE(actualCompletions, expectedCompletions);
 }
 
-- 
GitLab