Commit 2070431d authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

C++: Fix resolving of partial specialization

Use-case:
struct b {};
template<class X, class Y> struct s { float f; };
template<class X> struct s<X, b> { int i; };

void f()
{
    s<int, b> var;
    var.i; // i not highlighted
}

Task-number: QTCREATORBUG-14036
Change-Id: I70a87499e0a375e84d992ca0a79d77270a3419e8
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent d8c012e2
......@@ -1212,6 +1212,9 @@ LookupScopePrivate *LookupScopePrivate::findSpecialization(
}
}
}
if (specializationTemplateArgument == initializationTemplateArgument)
return cit->second;
}
}
}
......
......@@ -2623,6 +2623,20 @@ void CppToolsPlugin::test_completion_data()
) << _("s.") << (QStringList()
<< QLatin1String("S"));
QTest::newRow("partial_specialization") << _(
"struct b {};\n"
"template<class X, class Y> struct s { float f; };\n"
"template<class X> struct s<X, b> { int i; };\n"
"\n"
"void f()\n"
"{\n"
" s<int, b> var;\n"
" @\n"
"}\n"
) << _("var.") << (QStringList()
<< QLatin1String("i")
<< QLatin1String("s"));
QTest::newRow("auto_declaration_in_if_condition") << _(
"struct Foo { int bar; };\n"
"void fun() {\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment