diff options
author | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2014-04-30 09:07:57 +0200 |
---|---|---|
committer | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2014-08-01 09:59:59 +0200 |
commit | ba42ceb0cb7827a9bbad29a1e08d4a25339ea57d (patch) | |
tree | 5f1803c8c902fe0453eda7533c23f70fb86278cc /src/plugins/cpptools/cppcompletion_test.cpp | |
parent | 0bc202d52fca029849e38b05f91efed4d1ee7bd1 (diff) | |
download | qt-creator-ba42ceb0cb7827a9bbad29a1e08d4a25339ea57d.tar.gz |
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 <typename T>
struct Enclosing
{
typedef Enclosing<T> EnclosingT;// first case
struct Nested
{
typedef Enclosing<T> EnclosingT;// second case
};
};
Task-number: QTCREATORBUG-11752
Task-number: QTCREATORBUG-11999
Change-Id: Iadd7b5ef73ee0c4881f59c9dabfe03339f55827b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcompletion_test.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
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 <typename T>\n" + "struct Temp\n" + "{\n" + " struct Nested\n" + " {\n" + " typedef Temp<T> TempT;\n" + " T t;\n" + " };\n" + " Nested nested;\n" + "};\n" + "struct Foo { int foo; };\n" + "void fun() {\n" + " Temp<Foo> tempFoo;\n" + " @\n" + "}\n" + ) << _("tempFoo.nested.t.") << (QStringList() + << QLatin1String("foo") + << QLatin1String("Foo")); + QTest::newRow("lambda_parameter") << _( "auto func = [](int arg1) { return @; };\n" ) << _("ar") << (QStringList() |