parent
221873e69f
commit
c6c339a3e7
|
@ -438,7 +438,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
|
||||||
// Skip variadic types (Ticket #5774, #6059, #6172)
|
// Skip variadic types (Ticket #5774, #6059, #6172)
|
||||||
if (Token::simpleMatch(tok, "...")) {
|
if (Token::simpleMatch(tok, "...")) {
|
||||||
if ((tok->previous()->isName() && !Token::Match(tok->tokAt(-2), "<|,|::")) ||
|
if ((tok->previous()->isName() && !Token::Match(tok->tokAt(-2), "<|,|::")) ||
|
||||||
(!tok->previous()->isName() && tok->strAt(-1) != ">"))
|
(!tok->previous()->isName() && !Token::Match(tok->previous(), ">|&")))
|
||||||
return 0; // syntax error
|
return 0; // syntax error
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
if (!tok)
|
if (!tok)
|
||||||
|
|
|
@ -5297,6 +5297,7 @@ private:
|
||||||
ASSERT_EQUALS(4U, templateParameters("template<template<typename>...Foo,int,template<template<template<typename>>>,int> x;"));
|
ASSERT_EQUALS(4U, templateParameters("template<template<typename>...Foo,int,template<template<template<typename>>>,int> x;"));
|
||||||
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 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(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
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function to unit test TemplateSimplifier::getTemplateNamePosition
|
// Helper function to unit test TemplateSimplifier::getTemplateNamePosition
|
||||||
|
|
Loading…
Reference in New Issue