summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletion_test.cpp
diff options
context:
space:
mode:
authorPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2015-02-06 12:25:31 +0100
committerOrgad Shaneh <orgads@gmail.com>2015-02-25 15:03:43 +0000
commit1a239bd3e978b41fd03b0757314f8a6e88efa0b7 (patch)
treeb69c0cb367f7412a5e0da4bf32e8af546f4a7974 /src/plugins/cpptools/cppcompletion_test.cpp
parent209078e57e97cd45c213c58a21df02c9a1ad89c8 (diff)
downloadqt-creator-1a239bd3e978b41fd03b0757314f8a6e88efa0b7.tar.gz
C++: fix dereferencing of nested type and operator '->'
Fixed case: template<class T> struct List { struct iterator { T *operator->() { return &t; } T t; }; iterator begin() { return iterator(); } }; struct Foo { int bar; }; void func() { List<Foo> list; list.begin()->; // code completion doesn't work } Task-number: QTCREATORBUG-13799 Change-Id: I65e8d3092bbc9b01a5dbee241c24d95dd03fc670 Reviewed-by: Orgad Shaneh <orgads@gmail.com> 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.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index f51cdb0d3a..33c84f8df4 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -2533,6 +2533,26 @@ void CppToolsPlugin::test_completion_data()
) << _("(*list.begin()).") << (QStringList()
<< QLatin1String("Foo")
<< QLatin1String("bar"));
+
+ QTest::newRow("dereference_of_nested_type_opertor_->") << _(
+ "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"
+ " QList<Foo> list;\n"
+ " @\n"
+ "}\n"
+ ) << _("list.begin()->") << (QStringList()
+ << QLatin1String("Foo")
+ << QLatin1String("bar"));
}
void CppToolsPlugin::test_completion_member_access_operator()