forked from qt-creator/qt-creator
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: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
d8c012e29b
commit
2070431d8c
@@ -1212,6 +1212,9 @@ LookupScopePrivate *LookupScopePrivate::findSpecialization(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (specializationTemplateArgument == initializationTemplateArgument)
|
||||||
|
return cit->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2623,6 +2623,20 @@ void CppToolsPlugin::test_completion_data()
|
|||||||
) << _("s.") << (QStringList()
|
) << _("s.") << (QStringList()
|
||||||
<< QLatin1String("S"));
|
<< 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") << _(
|
QTest::newRow("auto_declaration_in_if_condition") << _(
|
||||||
"struct Foo { int bar; };\n"
|
"struct Foo { int bar; };\n"
|
||||||
"void fun() {\n"
|
"void fun() {\n"
|
||||||
|
Reference in New Issue
Block a user