* Fix cppcheckError with starship operator (#10251) * Fix test case * Return result
This commit is contained in:
parent
6c82fb05a4
commit
5ac4afa5b8
|
@ -111,6 +111,8 @@ R calculate(const std::string& s, const T& x, const T& y, bool* error = nullptr)
|
||||||
return wrap(x >= y);
|
return wrap(x >= y);
|
||||||
case '<=':
|
case '<=':
|
||||||
return wrap(x <= y);
|
return wrap(x <= y);
|
||||||
|
case '<=>':
|
||||||
|
return wrap(x - y);
|
||||||
}
|
}
|
||||||
throw InternalError(nullptr, "Unknown operator: " + s);
|
throw InternalError(nullptr, "Unknown operator: " + s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1075,6 +1075,13 @@ private:
|
||||||
ASSERT_EQUALS(22, values.back().intvalue);
|
ASSERT_EQUALS(22, values.back().intvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #10251 starship operator
|
||||||
|
code = "struct X {};\n"
|
||||||
|
"auto operator<=>(const X & a, const X & b) -> decltype(1 <=> 2) {\n"
|
||||||
|
" return std::strong_ordering::less;\n"
|
||||||
|
"}\n";
|
||||||
|
tokenValues(code, "<=>"); // don't throw
|
||||||
|
|
||||||
// Comparison of string
|
// Comparison of string
|
||||||
values = removeImpossible(tokenValues("f(\"xyz\" == \"xyz\");", "==")); // implementation defined
|
values = removeImpossible(tokenValues("f(\"xyz\" == \"xyz\");", "==")); // implementation defined
|
||||||
ASSERT_EQUALS(0U, values.size()); // <- no value
|
ASSERT_EQUALS(0U, values.size()); // <- no value
|
||||||
|
|
Loading…
Reference in New Issue