Skip to content

Commit a5babf2

Browse files
committed
Fixed #10080 (syntax error: operator)
1 parent 56124f0 commit a5babf2

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

lib/tokenize.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11384,6 +11384,11 @@ void Tokenizer::simplifyOperatorName()
1138411384
}
1138511385
op += ")";
1138611386
par = par->next();
11387+
if (Token::simpleMatch(par, "...")) {
11388+
op.clear();
11389+
par = nullptr;
11390+
break;
11391+
}
1138711392
done = false;
1138811393
} else if (Token::Match(par, "\"\" %name% (|;|<")) {
1138911394
op += "\"\"";

test/testtokenize.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ class TestTokenizer : public TestFixture {
427427
TEST_CASE(simplifyOperatorName25);
428428
TEST_CASE(simplifyOperatorName26);
429429
TEST_CASE(simplifyOperatorName27);
430+
TEST_CASE(simplifyOperatorName28);
430431

431432
TEST_CASE(simplifyOverloadedOperators1);
432433
TEST_CASE(simplifyOverloadedOperators2); // (*this)(123)
@@ -6737,6 +6738,14 @@ class TestTokenizer : public TestFixture {
67376738
tokenizeAndStringify(code));
67386739
}
67396740

6741+
void simplifyOperatorName28() {
6742+
const char code[] = "template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };\n"
6743+
"int main() { }";
6744+
ASSERT_EQUALS("template < class ... Ts > struct overloaded : Ts ... { using Ts :: operator ( ) ... ; } ;\n"
6745+
"int main ( ) { }",
6746+
tokenizeAndStringify(code));
6747+
}
6748+
67406749
void simplifyOverloadedOperators1() {
67416750
const char code[] = "struct S { void operator()(int); };\n"
67426751
"\n"

0 commit comments

Comments
 (0)