* Update templatesimplifier.cpp * Add tests
This commit is contained in:
parent
ae16aab997
commit
13d81cdd58
|
@ -438,7 +438,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
|
|||
// Skip variadic types (Ticket #5774, #6059, #6172)
|
||||
if (Token::simpleMatch(tok, "...")) {
|
||||
if ((tok->previous()->isName() && !Token::Match(tok->tokAt(-2), "<|,|::")) ||
|
||||
(!tok->previous()->isName() && !Token::Match(tok->previous(), ">|&")))
|
||||
(!tok->previous()->isName() && !Token::Match(tok->previous(), ">|&|&&|*")))
|
||||
return 0; // syntax error
|
||||
tok = tok->next();
|
||||
if (!tok)
|
||||
|
|
|
@ -5298,6 +5298,8 @@ private:
|
|||
ASSERT_EQUALS(2U, templateParameters("template<typename S, enable_if_t<(is_compile_string<S>::value), int>> void i(S s);"));
|
||||
ASSERT_EQUALS(2U, templateParameters("template<typename c, b<(c::d), int>> void e();"));
|
||||
ASSERT_EQUALS(3U, templateParameters("template <class T, class... Args, class Tup = std::tuple<Args&...>> constexpr void f() {}")); // #11351
|
||||
ASSERT_EQUALS(3U, templateParameters("template <class T, class... Args, class Tup = std::tuple<Args&&...>> void f() {}"));
|
||||
ASSERT_EQUALS(3U, templateParameters("template <class T, class... Args, class Tup = std::tuple<Args*...>> void f() {}"));
|
||||
}
|
||||
|
||||
// Helper function to unit test TemplateSimplifier::getTemplateNamePosition
|
||||
|
|
Loading…
Reference in New Issue