Don't throw internalAstError for parameter pack in template argument list (#4773)
This commit is contained in:
parent
4f8329b2df
commit
33a03f2c35
|
@ -691,7 +691,7 @@ static bool iscpp11init_impl(const Token * const tok)
|
||||||
if (!Token::simpleMatch(endtok, "} ;"))
|
if (!Token::simpleMatch(endtok, "} ;"))
|
||||||
return true;
|
return true;
|
||||||
const Token *prev = nameToken;
|
const Token *prev = nameToken;
|
||||||
while (Token::Match(prev, "%name%|::|:|<|>|(|)|,|%num%|%cop%")) {
|
while (Token::Match(prev, "%name%|::|:|<|>|(|)|,|%num%|%cop%|...")) {
|
||||||
if (Token::Match(prev, "class|struct|union|enum"))
|
if (Token::Match(prev, "class|struct|union|enum"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -7662,6 +7662,16 @@ private:
|
||||||
"{ } }",
|
"{ } }",
|
||||||
TokenImpl::Cpp11init::NOINIT);
|
TokenImpl::Cpp11init::NOINIT);
|
||||||
|
|
||||||
|
testIsCpp11init("struct S {};\n"
|
||||||
|
"template<class... Args>\n"
|
||||||
|
"struct T;\n"
|
||||||
|
"template<class... Args>\n"
|
||||||
|
"struct T<void, Args...> final : S {\n"
|
||||||
|
" void operator()(Args...) {}\n"
|
||||||
|
"};\n",
|
||||||
|
"{ void",
|
||||||
|
TokenImpl::Cpp11init::NOINIT);
|
||||||
|
|
||||||
ASSERT_NO_THROW(tokenizeAndStringify("template<typename U> struct X {};\n" // don't crash
|
ASSERT_NO_THROW(tokenizeAndStringify("template<typename U> struct X {};\n" // don't crash
|
||||||
"template<typename T> auto f(T t) -> X<decltype(t + 1)> {}\n"));
|
"template<typename T> auto f(T t) -> X<decltype(t + 1)> {}\n"));
|
||||||
#undef testIsCpp11init
|
#undef testIsCpp11init
|
||||||
|
|
Loading…
Reference in New Issue