summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2013-10-28 12:41:32 +0100
committerNikolai Kosjar <nikolai.kosjar@digia.com>2013-10-31 10:57:14 +0100
commit8f0be66d3da3346ab45d957e59b167886971d859 (patch)
tree3792a6e6e10e289fb72c65cac1894ea1b36d5d15 /src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
parent1113097c377cf0ce79574f12aacda174e4c55e88 (diff)
downloadqt-creator-8f0be66d3da3346ab45d957e59b167886971d859.tar.gz
CppEditor: Fix crash on virtual function override lookup
...involving templates. Task-number: QTCREATORBUG-10496 Change-Id: I485d691043f27b03e120353f0dfd6a2fb0aa07ec Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp')
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 2a2c754e63..6f9cff10c7 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -112,6 +112,8 @@ public:
IAssistProposal *immediateProposal = processor->immediateProposal(assistInterface);
IAssistProposal *finalProposal = processor->perform(assistInterface);
+ VirtualFunctionAssistProvider::clearParams();
+
m_immediateItems = itemList(immediateProposal->model());
m_finalItems = itemList(finalProposal->model());
@@ -1399,6 +1401,25 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_itemOrder
test.run();
}
+/// Check: If class templates are involved, the class and function symbols might be generated.
+/// In that case, make sure that the symbols are not deleted before we reference them.
+void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_instantiatedSymbols()
+{
+ const QByteArray source =
+ "template <class T> struct A { virtual void virt() {} };\n"
+ "void f(A<int> *l) { l->$@virt(); }\n"
+ ;
+
+ const OverrideItemList immediateResults = OverrideItemList()
+ << OverrideItem(QLatin1String("A::virt"), 1)
+ << OverrideItem(QLatin1String("...searching overrides"));
+ const OverrideItemList finalResults = OverrideItemList()
+ << OverrideItem(QLatin1String("A::virt"), 1);
+
+ TestCase test(TestCase::FollowSymbolUnderCursorAction, source, immediateResults, finalResults);
+ test.run();
+}
+
/// Check: Trigger on a.virt() if a is of type &A.
void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_onDotMemberAccessOfReferenceTypes()
{