Fixed handling of unexposed variadic template params

This commit is contained in:
Bartek Kryza
2023-04-24 00:28:38 +02:00
parent 3ed50ba3b2
commit 47ccb561c9
4 changed files with 46 additions and 1 deletions

View File

@@ -852,6 +852,12 @@ std::optional<template_parameter> build_template_parameter(
return res;
}
else if (common::is_type_token(*it) && *it_next == "...") {
// Variadic template parameter
auto parm = map_type_parameter_to_template_parameter(decl, *it);
parm.is_variadic(true);
return parm;
}
else if (common::is_type_token(*it) && *it_next == "(") {
res.add_template_param(
map_type_parameter_to_template_parameter(decl, *it));

View File

@@ -563,6 +563,21 @@ std::vector<std::string> tokenize_unexposed_template_parameter(
result.push_back("*");
tok.clear();
}
else if (c == '.') {
// This can only be the case if we have a variadic template,
// right?
if (tok == "..") {
result.push_back("...");
tok.clear();
}
else if (tok == ".") {
tok = "..";
}
else if (!tok.empty()) {
result.push_back(tok);
tok = ".";
}
}
else {
tok += c;
}