Fix 11090: Infinite recursion in findTypeInBase() (#4120)

This commit is contained in:
Paul Fultz II 2022-05-21 01:24:29 -05:00 committed by GitHub
parent 31560299f8
commit a62fb986a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -1884,6 +1884,8 @@ namespace {
}
bool findTypeInBase(const std::string &scope) const {
if (scope.empty())
return false;
// check in base types first
if (baseTypes.find(scope) != baseTypes.end())
return true;

View File

@ -6901,6 +6901,14 @@ private:
" ~a();\n"
"};\n"
"void d() { a::b<int>(); }\n"));
// #11090
ASSERT_NO_THROW(tokenizeAndStringify("using a = char;\n"
"using c = int;\n"
"template <typename = void> struct d {};\n"
"using b = c;\n"
"template <> struct d<b> : d<a> {};\n"
"template <> struct d<> : d<a> {};\n"));
}
void checkNamespaces() {