Ticket #6059: Properly handle class... in parameter lists.

This commit is contained in:
Simon Martin 2014-11-07 23:08:54 +01:00
parent 685fce6b91
commit cc6b51f2d9
2 changed files with 7 additions and 3 deletions

View File

@ -240,8 +240,8 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
if (Token::Match(tok, "& ::| %var%"))
tok = tok->next();
// Skip 'typename...' (Ticket #5774)
if (Token::simpleMatch(tok, "typename . . .")) {
// Skip 'typename...' and 'class...' (Ticket #5774, #6059)
if (Token::Match(tok, "typename|class . . .")) {
tok = tok->tokAt(4);
continue;
}

View File

@ -4410,7 +4410,7 @@ private:
tokenizer.tokenize(istr, "test.cpp"); // shouldn't segfault
}
void syntax_error_templates_3() { // Ticket #5605, #5759, #5762, #5774, #5823
void syntax_error_templates_3() { // Ticket #5605, #5759, #5762, #5774, #5823, #6059
tokenizeAndStringify("foo() template<typename T1 = T2 = typename = unused, T5 = = unused> struct tuple Args> tuple<Args...> { } main() { foo<int,int,int,int,int,int>(); }");
tokenizeAndStringify("( ) template < T1 = typename = unused> struct Args { } main ( ) { foo < int > ( ) ; }");
tokenizeAndStringify("() template < T = typename = x > struct a {} { f <int> () }");
@ -4432,6 +4432,10 @@ private:
" C() : _a(0), _b(0) {} "
" int _a, _b; "
"};");
tokenizeAndStringify("template<class... T> struct A { "
" static int i; "
"}; "
"void f() { A<int>::i = 0; }");
}
void template_member_ptr() { // Ticket #5786