From 955e28f954746a6a7242fe8fa67dd7c53b8e2430 Mon Sep 17 00:00:00 2001 From: Przemyslaw Gorszkowski Date: Mon, 2 Feb 2015 15:13:00 +0100 Subject: 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 --- src/plugins/cpptools/cppcompletion_test.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/plugins/cpptools/cppcompletion_test.cpp') 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() -- cgit v1.2.1