diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d3f8732a5..5666f91f8 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -11384,6 +11384,11 @@ void Tokenizer::simplifyOperatorName() } op += ")"; par = par->next(); + if (Token::simpleMatch(par, "...")) { + op.clear(); + par = nullptr; + break; + } done = false; } else if (Token::Match(par, "\"\" %name% (|;|<")) { op += "\"\""; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 98ef5f06d..cca6c3231 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -427,6 +427,7 @@ private: TEST_CASE(simplifyOperatorName25); TEST_CASE(simplifyOperatorName26); TEST_CASE(simplifyOperatorName27); + TEST_CASE(simplifyOperatorName28); TEST_CASE(simplifyOverloadedOperators1); TEST_CASE(simplifyOverloadedOperators2); // (*this)(123) @@ -6737,6 +6738,14 @@ private: tokenizeAndStringify(code)); } + void simplifyOperatorName28() { + const char code[] = "template struct overloaded : Ts... { using Ts::operator()...; };\n" + "int main() { }"; + ASSERT_EQUALS("template < class ... Ts > struct overloaded : Ts ... { using Ts :: operator ( ) ... ; } ;\n" + "int main ( ) { }", + tokenizeAndStringify(code)); + } + void simplifyOverloadedOperators1() { const char code[] = "struct S { void operator()(int); };\n" "\n"