summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletion_test.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2015-02-22 20:04:53 +0200
committerOrgad Shaneh <orgads@gmail.com>2015-02-26 10:09:42 +0000
commitb30e807fac091e32815e0a5cce58a71939792b7c (patch)
tree70d1d6a7f8f4387ca842de8a8dd386873ad6d776 /src/plugins/cpptools/cppcompletion_test.cpp
parent8c11485edba3718925624612f2336d7853da297f (diff)
downloadqt-creator-b30e807fac091e32815e0a5cce58a71939792b7c.tar.gz
C++: Fix crash on static template instantiation
template<typename T> struct QList { struct iterator { T *operator->() { return &t; } T t; }; static iterator begin() { return iterator(); } }; struct Foo { int bar; }; void fun() { auto a = QList<Foo>::begin(); a. // crash } Change-Id: I373c493b2eefc9566ec13165285c33d474a3b440 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index bf6bfb4679..49294eb146 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -2595,6 +2595,27 @@ void CppToolsPlugin::test_completion_data()
) << _("a->") << (QStringList()
<< QLatin1String("Foo")
<< QLatin1String("bar"));
+
+ QTest::newRow("direct_nested_template_type_access") << _(
+ "template<typename T>\n"
+ "struct QList\n"
+ "{\n"
+ " struct iterator\n"
+ " {\n"
+ " T *operator->() { return &t; }\n"
+ " T t;\n"
+ " };\n"
+ " iterator begin() { return iterator(); }\n"
+ "};\n"
+ "struct Foo { int bar; };\n"
+ "void fun() {\n"
+ " auto a = QList<Foo>::begin();\n"
+ " @\n"
+ "}\n"
+ ) << _("a.") << (QStringList()
+ << QLatin1String("operator ->")
+ << QLatin1String("t")
+ << QLatin1String("iterator"));
}
void CppToolsPlugin::test_completion_member_access_operator()