* 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);
|
||||
case '<=':
|
||||
return wrap(x <= y);
|
||||
case '<=>':
|
||||
return wrap(x - y);
|
||||
}
|
||||
throw InternalError(nullptr, "Unknown operator: " + s);
|
||||
}
|
||||
|
|
|
@ -1075,6 +1075,13 @@ private:
|
|||
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
|
||||
values = removeImpossible(tokenValues("f(\"xyz\" == \"xyz\");", "==")); // implementation defined
|
||||
ASSERT_EQUALS(0U, values.size()); // <- no value
|
||||
|
|
Loading…
Reference in New Issue