Add regression test for #7798 (#1847)

Trac ticket #7798 was fixed in 3f1e2b4270
(More conservative fallback for function overload matching). Add a test
to avoid regressions.
This commit is contained in:
Rikard Falkeborn 2019-06-15 11:34:06 +02:00 committed by Daniel Marjamäki
parent b466415bb4
commit b970606c93
1 changed files with 14 additions and 0 deletions

View File

@ -60,6 +60,7 @@ private:
TEST_CASE(checkComparisonOfFuncReturningBool4); TEST_CASE(checkComparisonOfFuncReturningBool4);
TEST_CASE(checkComparisonOfFuncReturningBool5); TEST_CASE(checkComparisonOfFuncReturningBool5);
TEST_CASE(checkComparisonOfFuncReturningBool6); TEST_CASE(checkComparisonOfFuncReturningBool6);
TEST_CASE(checkComparisonOfFuncReturningBool7); // #7798 overloaded functions
TEST_CASE(checkComparisonOfBoolWithBool); TEST_CASE(checkComparisonOfBoolWithBool);
// Converting pointer addition result to bool // Converting pointer addition result to bool
@ -726,6 +727,19 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
// Integration test
void checkComparisonOfFuncReturningBool7() { // #7798
check("bool eval(double *) { return false; }\n"
"double eval(char *) { return 1.0; }\n"
"int main(int argc, char *argv[])\n"
"{\n"
" if ( eval(argv[1]) > eval(argv[2]) )\n"
" return 1;\n"
" return 0;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void checkComparisonOfBoolWithBool() { void checkComparisonOfBoolWithBool() {
const char code[] = "void f(){\n" const char code[] = "void f(){\n"
" int temp = 4;\n" " int temp = 4;\n"