summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletion_test.cpp
diff options
context:
space:
mode:
authorPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2013-05-19 07:23:57 +0200
committerErik Verbruggen <erik.verbruggen@digia.com>2013-05-24 11:35:11 +0200
commit80e1ae805982c8dd9b34903accb9ed3449337a63 (patch)
tree7aeb2900f61217bfab4170f096a15dc1b618b530 /src/plugins/cpptools/cppcompletion_test.cpp
parent2e9f6a7935f0a725f357245b1cd0e7bfe8792d73 (diff)
downloadqt-creator-80e1ae805982c8dd9b34903accb9ed3449337a63.tar.gz
C++: fix crash during code completion with base template class
ResolveExpression has to have a reference of ContextLookup. If not there will be a crash because of deleted instanitated base template class. Task-number: QTCREATORBUG-9329 Change-Id: I7f8c83da0d81ac6311e76d15a897adbc70b08d75 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index 67af9b9497..11e380092b 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -1798,3 +1798,37 @@ void CppToolsPlugin::test_completion_namespace_alias_with_many_namespace_declara
QVERIFY(completions.contains(QLatin1String("Foo1")));
QVERIFY(completions.contains(QLatin1String("Foo2")));
}
+
+void CppToolsPlugin::test_completion_crash_cloning_template_class_QTCREATORBUG9329()
+{
+ TestData data;
+ data.srcText =
+ "struct A {};\n"
+ "template <typename T>\n"
+ "struct Templ {};\n"
+ "struct B : A, Templ<A>\n"
+ "{\n"
+ " int f()\n"
+ " {\n"
+ " @\n"
+ " // padding so we get the scope right\n"
+ " }\n"
+ "};\n"
+ ;
+ setup(&data);
+
+ Utils::ChangeSet change;
+ QString txt = QLatin1String("this->");
+ change.insert(data.pos, txt);
+ QTextCursor cursor(data.doc);
+ change.apply(&cursor);
+ data.pos += txt.length();
+
+ QStringList completions = getCompletions(data);
+
+ QCOMPARE(completions.size(), 4);
+ QVERIFY(completions.contains(QLatin1String("A")));
+ QVERIFY(completions.contains(QLatin1String("B")));
+ QVERIFY(completions.contains(QLatin1String("Templ")));
+ QVERIFY(completions.contains(QLatin1String("f")));
+}