From ba42ceb0cb7827a9bbad29a1e08d4a25339ea57d Mon Sep 17 00:00:00 2001 From: Przemyslaw Gorszkowski Date: Wed, 30 Apr 2014 09:07:57 +0200 Subject: C++: nested class with enclosing template class The parent of instantiation of nested class of template class should be the instantiation of enclosing template class. To prevent the infinite loop for case with local typedef of enclosing template we should not change a parent of typedefed instatiation of enclosing template. Example: template struct Enclosing { typedef Enclosing EnclosingT;// first case struct Nested { typedef Enclosing EnclosingT;// second case }; }; Task-number: QTCREATORBUG-11752 Task-number: QTCREATORBUG-11999 Change-Id: Iadd7b5ef73ee0c4881f59c9dabfe03339f55827b Reviewed-by: Nikolai Kosjar --- src/plugins/cpptools/cppcompletion_test.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/plugins/cpptools/cppcompletion_test.cpp') diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index e96c790c6c..c1e03a8401 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -306,8 +306,6 @@ 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); } @@ -2264,6 +2262,26 @@ void CppToolsPlugin::test_completion_data() << QLatin1String("foo") << QLatin1String("Foo")); + QTest::newRow("infiniteLoopLocalTypedef_QTCREATORBUG-11999") << _( + "template \n" + "struct Temp\n" + "{\n" + " struct Nested\n" + " {\n" + " typedef Temp TempT;\n" + " T t;\n" + " };\n" + " Nested nested;\n" + "};\n" + "struct Foo { int foo; };\n" + "void fun() {\n" + " Temp tempFoo;\n" + " @\n" + "}\n" + ) << _("tempFoo.nested.t.") << (QStringList() + << QLatin1String("foo") + << QLatin1String("Foo")); + QTest::newRow("lambda_parameter") << _( "auto func = [](int arg1) { return @; };\n" ) << _("ar") << (QStringList() -- cgit v1.2.1