Workaround token issue in unnamed variadic template parameter
This commit is contained in:
parent
365677b2c9
commit
133d51b630
2 changed files with 16 additions and 2 deletions
|
|
@ -166,6 +166,18 @@ namespace
|
|||
// now we found the proper end of the token
|
||||
end = get_next_location(tu, file, next, -1);
|
||||
}
|
||||
else if ((kind == CXCursor_TemplateTypeParameter
|
||||
|| kind == CXCursor_NonTypeTemplateParameter
|
||||
|| kind == CXCursor_TemplateTemplateParameter)
|
||||
&& token_after_is(tu, file, cur, end, "..."))
|
||||
{
|
||||
// variadic tokens in unnamed parameter not included
|
||||
end = get_next_location(tu, file, end, 3);
|
||||
DEBUG_ASSERT(token_after_is(tu, file, cur, end, ">")
|
||||
|| token_after_is(tu, file, cur, end, ","),
|
||||
detail::parse_error_handler{}, cur,
|
||||
"unexpected token in variadic parameter workaround");
|
||||
}
|
||||
else if ((kind == CXCursor_TemplateTypeParameter
|
||||
|| kind == CXCursor_NonTypeTemplateParameter
|
||||
|| kind == CXCursor_TemplateTemplateParameter)
|
||||
|
|
@ -173,7 +185,8 @@ namespace
|
|||
&& !token_after_is(tu, file, cur, end, ","))
|
||||
{
|
||||
DEBUG_ASSERT(token_after_is(tu, file, cur, get_next_location(tu, file, end, -2), ">>"),
|
||||
detail::assert_handler{});
|
||||
detail::parse_error_handler{}, cur,
|
||||
"unexpected token in maximal munch workaround");
|
||||
unmunch = true;
|
||||
// need to shrink range anyway
|
||||
end = get_next_location(tu, file, end, -1);
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ using b = void;
|
|||
template <template <int> class C = ns::def>
|
||||
using c = void;
|
||||
|
||||
template <template <template <typename> class> class D = a>
|
||||
template <template <template <typename...> class> class D = a>
|
||||
using d = void;
|
||||
)";
|
||||
|
||||
|
|
@ -309,6 +309,7 @@ using d = void;
|
|||
++no;
|
||||
REQUIRE(p_p_param.name() == "");
|
||||
REQUIRE(p_p_param.kind() == cpp_entity_kind::template_type_parameter_t);
|
||||
REQUIRE(p_p_param.is_variadic());
|
||||
}
|
||||
}
|
||||
REQUIRE(no == 2u);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue