diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index dc96c304a5933511ce97cb6cf157a6e959c6b000..2afe046ac0f54f528912601aad7fc6f879aed2b7 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -1215,6 +1215,13 @@ LookupScopePrivate *LookupScopePrivate::findSpecialization( if (specializationTemplateArgument == initializationTemplateArgument) return cit->second; + + if (const NamedType *specName = specializationTemplateArgument->asNamedType()) { + if (const NamedType *initName = initializationTemplateArgument->asNamedType()) { + if (specName->name()->identifier() == initName->name()->identifier()) + return cit->second; + } + } } } } diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index 82a58d4760f0f757a3b4151991b2aff17a68c880..d8bd4101e23bae6ca250b34ce592c186261555e6 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -2637,6 +2637,21 @@ void CppToolsPlugin::test_completion_data() << QLatin1String("i") << QLatin1String("s")); + QTest::newRow("partial_specialization_templated_argument") << _( + "template<class T> struct t {};\n" + "\n" + "template<class> struct s { float f; };\n" + "template<class X> struct s<t<X>> { int i; };\n" + "\n" + "void f()\n" + "{\n" + " s<t<char>> 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"