summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletion_test.cpp
diff options
context:
space:
mode:
authorPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2015-02-02 15:13:00 +0100
committerPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2015-02-04 11:55:04 +0000
commit955e28f954746a6a7242fe8fa67dd7c53b8e2430 (patch)
treef403719446176b281accb95f84e34d4b5be90fec /src/plugins/cpptools/cppcompletion_test.cpp
parent7d4b9c4ba0936adf8ad1fcaf0093d15f394e3023 (diff)
downloadqt-creator-955e28f954746a6a7242fe8fa67dd7c53b8e2430.tar.gz
C++: fix auto declaration in if condition
Fix for auto completion in case of auto declaration inside if condition: struct Foo { int bar; }; void func() { if (auto s = new Foo) s->; // auto completion does not work } Task-number: QTCREATORBUG-13805 Change-Id: Ia1776e8cc04e6040a6bf5f43cf82cfd6ce6dde7a 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.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index bf16f2e219..717687b6a6 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -2384,6 +2384,17 @@ void CppToolsPlugin::test_completion_data()
"}\n"
) << _("s.") << (QStringList()
<< QLatin1String("S"));
+
+ QTest::newRow("auto_declaration_in_if_condition") << _(
+ "struct Foo { int bar; };\n"
+ "void fun() {\n"
+ " if (auto s = new Foo) {\n"
+ " @\n"
+ " }\n"
+ "}\n"
+ ) << _("s->") << (QStringList()
+ << QLatin1String("Foo")
+ << QLatin1String("bar"));
}
void CppToolsPlugin::test_completion_member_access_operator()