* Fix #10138 syntax error : int (operator"" _ii)(unsigned long long v) { return v; } * Format
This commit is contained in:
parent
2fee7a6e3f
commit
1aa259569e
|
@ -9223,10 +9223,16 @@ void Tokenizer::simplifyOperatorName()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
done = false;
|
done = false;
|
||||||
} else if (Token::Match(par, "\"\" %name% (|;|<")) {
|
} else if (Token::Match(par, "\"\" %name% )| (|;|<")) {
|
||||||
op += "\"\"";
|
op += "\"\"";
|
||||||
op += par->strAt(1);
|
op += par->strAt(1);
|
||||||
par = par->tokAt(2);
|
par = par->tokAt(2);
|
||||||
|
if (par->str() == ")") {
|
||||||
|
par->link()->deleteThis();
|
||||||
|
par = par->next();
|
||||||
|
par->deletePrevious();
|
||||||
|
tok = par->tokAt(-3);
|
||||||
|
}
|
||||||
done = true;
|
done = true;
|
||||||
} else if (par->str() == "::") {
|
} else if (par->str() == "::") {
|
||||||
op += par->str();
|
op += par->str();
|
||||||
|
|
|
@ -350,6 +350,7 @@ private:
|
||||||
TEST_CASE(simplifyOperatorName29); // spaceship operator
|
TEST_CASE(simplifyOperatorName29); // spaceship operator
|
||||||
TEST_CASE(simplifyOperatorName31); // #6342
|
TEST_CASE(simplifyOperatorName31); // #6342
|
||||||
TEST_CASE(simplifyOperatorName32); // #10256
|
TEST_CASE(simplifyOperatorName32); // #10256
|
||||||
|
TEST_CASE(simplifyOperatorName33); // #10138
|
||||||
|
|
||||||
TEST_CASE(simplifyOverloadedOperators1);
|
TEST_CASE(simplifyOverloadedOperators1);
|
||||||
TEST_CASE(simplifyOverloadedOperators2); // (*this)(123)
|
TEST_CASE(simplifyOverloadedOperators2); // (*this)(123)
|
||||||
|
@ -4987,6 +4988,12 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void simplifyOperatorName33() { // #10138
|
||||||
|
const char code[] = "int (operator\"\" _ii)(unsigned long long v) { return v; }\n";
|
||||||
|
ASSERT_EQUALS("int operator\"\"_ii ( unsigned long long v ) { return v ; }", tokenizeAndStringify(code));
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void simplifyOperatorName10() { // #8746
|
void simplifyOperatorName10() { // #8746
|
||||||
const char code1[] = "using a::operator=;";
|
const char code1[] = "using a::operator=;";
|
||||||
ASSERT_EQUALS("using a :: operator= ;", tokenizeAndStringify(code1));
|
ASSERT_EQUALS("using a :: operator= ;", tokenizeAndStringify(code1));
|
||||||
|
|
Loading…
Reference in New Issue