Fix infinite recursion in decltype type

This commit is contained in:
Jonathan Müller 2017-04-11 19:15:52 +02:00
commit d125869df5

View file

@ -435,7 +435,7 @@ namespace
}); });
} }
std::unique_ptr<cpp_type> try_parse_decltype_type(const detail::parse_context& context, std::unique_ptr<cpp_type> try_parse_decltype_type(const detail::parse_context&,
const CXCursor& cur, const CXType& type) const CXCursor& cur, const CXType& type)
{ {
if (clang_isExpression(clang_getCursorKind(cur))) if (clang_isExpression(clang_getCursorKind(cur)))
@ -447,10 +447,9 @@ namespace
DEBUG_ASSERT(!spelling.empty() && spelling.back() == ')', detail::parse_error_handler{}, DEBUG_ASSERT(!spelling.empty() && spelling.back() == ')', detail::parse_error_handler{},
type, "unexpected spelling"); type, "unexpected spelling");
spelling.pop_back(); spelling.pop_back();
return cpp_decltype_type::build( return cpp_decltype_type::build(
cpp_unexposed_expression::build(detail::parse_type(context, cur, cpp_unexposed_expression::build(cpp_unexposed_type::build("<decltype>"), spelling));
clang_getCanonicalType(type)),
spelling));
}); });
} }