C++: Resolve function-scope typedef inside lambda

Use-case:
struct Foo { int bar; };

void func()
{
    typedef Foo F;
    []() {
        F f;
        f.bar; // bar not highlighted
    };
}

Change-Id: Ifaee2d125931d993acad69f03031a675c6180858
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-06-28 22:28:44 +03:00
committed by Orgad Shaneh
parent 1faf2bd1ef
commit f8544bbc42
2 changed files with 22 additions and 0 deletions

View File

@@ -2547,6 +2547,21 @@ void CppToolsPlugin::test_completion_data()
) << _("ar") << (QStringList()
<< QLatin1String("arg1"));
QTest::newRow("local_typedef_access_in_lambda") << _(
"struct Foo { int bar; };\n"
"\n"
"void func()\n"
"{\n"
" typedef Foo F;\n"
" []() {\n"
" F f;\n"
" @\n"
" };\n"
"}\n"
) << _("f.") << (QStringList()
<< QLatin1String("Foo")
<< QLatin1String("bar"));
QTest::newRow("default_arguments_for_class_templates_and_base_class_QTCREATORBUG-12605") << _(
"struct Foo { int foo; };\n"
"template <typename T = Foo>\n"