Fix #11386 debug: CheckClass::checkConst found unlinked template argument list (#4614)

This commit is contained in:
chrchr-github 2022-12-07 09:12:46 +01:00 committed by GitHub
parent d5d7446433
commit 0e57c27dd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -521,7 +521,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
return 0;
// inner template
if (tok->str() == "<") {
if (tok->str() == "<" && tok->previous()->isName()) {
++level;
tok = tok->next();
}

View File

@ -5300,6 +5300,7 @@ private:
ASSERT_EQUALS(3U, templateParameters("template <class T, class... Args, class Tup = std::tuple<Args&...>> constexpr void f() {}")); // #11351
ASSERT_EQUALS(3U, templateParameters("template <class T, class... Args, class Tup = std::tuple<Args&&...>> void f() {}"));
ASSERT_EQUALS(3U, templateParameters("template <class T, class... Args, class Tup = std::tuple<Args*...>> void f() {}"));
ASSERT_EQUALS(1U, templateParameters("S<4 < sizeof(uintptr_t)> x;"));
}
// Helper function to unit test TemplateSimplifier::getTemplateNamePosition