From b970606c93d2a815fbdf0e618e7a078985580d53 Mon Sep 17 00:00:00 2001 From: Rikard Falkeborn Date: Sat, 15 Jun 2019 11:34:06 +0200 Subject: [PATCH] Add regression test for #7798 (#1847) Trac ticket #7798 was fixed in 3f1e2b42700a1eb1466d4200eb87265defd962f6 (More conservative fallback for function overload matching). Add a test to avoid regressions. --- test/testbool.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/testbool.cpp b/test/testbool.cpp index 3c629136a..bd9a3a680 100644 --- a/test/testbool.cpp +++ b/test/testbool.cpp @@ -60,6 +60,7 @@ private: TEST_CASE(checkComparisonOfFuncReturningBool4); TEST_CASE(checkComparisonOfFuncReturningBool5); TEST_CASE(checkComparisonOfFuncReturningBool6); + TEST_CASE(checkComparisonOfFuncReturningBool7); // #7798 overloaded functions TEST_CASE(checkComparisonOfBoolWithBool); // Converting pointer addition result to bool @@ -726,6 +727,19 @@ private: 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() { const char code[] = "void f(){\n" " int temp = 4;\n"