Fixed #10080 (syntax error: operator)
This commit is contained in:
parent
56124f0c5d
commit
a5babf25a7
|
@ -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 += "\"\"";
|
||||
|
|
|
@ -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<class... Ts> 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"
|
||||
|
|
Loading…
Reference in New Issue