forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user