C++: base class and default argument for template class

Fix code completion in case:
struct Foo
{
  int bar;
};

template <typename T1 = Foo>
struct Derived : T1 { };

int main()
{
  Derived<> foo;
  foo. // members from Foo are not proposed
  return 0;
}

Task-number: QTCREATORBUG-12605
Change-Id: Ibe35c7b9a161e789057a4518c72390ac52489a3e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Przemyslaw Gorszkowski
2014-07-03 09:00:00 +02:00
committed by Orgad Shaneh
parent 87dcde5564
commit 4aa4e64b77
2 changed files with 21 additions and 1 deletions

View File

@@ -2268,6 +2268,19 @@ void CppToolsPlugin::test_completion_data()
"auto func = [](int arg1) { return @; };\n"
) << _("ar") << (QStringList()
<< QLatin1String("arg1"));
QTest::newRow("default_arguments_for_class_templates_and_base_class_QTCREATORBUG-12605") << _(
"struct Foo { int foo; };\n"
"template <typename T = Foo>\n"
"struct Derived : T {};\n"
"void fun() {\n"
" Derived<> derived;\n"
" @\n"
"}\n"
) << _("derived.") << (QStringList()
<< QLatin1String("Derived")
<< QLatin1String("foo")
<< QLatin1String("Foo"));
}
void CppToolsPlugin::test_completion_member_access_operator()