Prevent infinite recursion during alias resolution #18

This commit is contained in:
Bartek Kryza
2022-03-05 22:10:27 +01:00
parent 2583661d31
commit 17de8b7ded
3 changed files with 15 additions and 3 deletions

View File

@@ -115,7 +115,12 @@ translation_unit_context::get_type_alias_final(const cppast::cpp_type &t) const
cx::util::full_name(cppast::remove_cv(t), entity_index_, false);
if (has_type_alias(type_full_name)) {
return get_type_alias_final(alias_index_.at(type_full_name).get());
const auto &alias_type = alias_index_.at(type_full_name).get();
// Prevent infinite recursion
if (type_full_name !=
cx::util::full_name(
cppast::remove_cv(alias_type), entity_index_, false))
return get_type_alias_final(alias_type);
}
return type_safe::ref(t);