C++: Fix resolving of using in enclosing scope

Use-case:
namespace Ns {
namespace Nested {
struct Foo
{
    void func();
    int bar;
};
}
}

using namespace Ns::Nested;

namespace Ns
{
void Foo::func()
{
    bar; // bar not highlighted
}
}

Change-Id: I6e667d63eb40511d65532c4d6d317aa4028a87a4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-06-28 23:21:02 +03:00
committed by Orgad Shaneh
parent 28e163de97
commit 1faf2bd1ef
2 changed files with 24 additions and 1 deletions

View File

@@ -1551,6 +1551,29 @@ void CppToolsPlugin::test_completion_data()
<< QLatin1String("C")
<< QLatin1String("m"));
QTest::newRow("type_and_using_declaration: type in nested namespace and using in global") << _(
"namespace Ns {\n"
"namespace Nested {\n"
"struct Foo\n"
"{\n"
" void func();\n"
" int m_bar;\n"
"};\n"
"}\n"
"}\n"
"\n"
"using namespace Ns::Nested;\n"
"\n"
"namespace Ns\n"
"{\n"
"void Foo::func()\n"
"{\n"
" @\n"
"}\n"
"}\n"
) << _("m_") << (QStringList()
<< QLatin1String("m_bar"));
QTest::newRow("instantiate_template_with_anonymous_class") << _(
"template <typename T>\n"
"struct S\n"