diff --git a/test/testclass.cpp b/test/testclass.cpp index 6891f1b21..a44b64e3e 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -7553,6 +7553,14 @@ private: " virtual void VirtualMethod() = 0;\n" "};"); ASSERT_EQUALS("", errout.str()); + + // #10559 + checkVirtualFunctionCall("struct S {\n" + " S(const int x) : m(std::bind(&S::f, this, x, 42)) {}\n" + " virtual int f(const int x, const int y) = 0;\n" + " std::function m;\n" + "};\n"); + ASSERT_EQUALS("", errout.str()); } void pureVirtualFunctionCallOtherClass() { diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 42bc016d4..e74ab390b 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -424,6 +424,7 @@ private: TEST_CASE(noCrash2); TEST_CASE(noCrash3); TEST_CASE(noCrash4); + TEST_CASE(noCrash5); // #10603 // --check-config TEST_CASE(checkConfiguration); @@ -7094,6 +7095,12 @@ private: "}\n")); } + void noCrash5() // #10603 + { + ASSERT_NO_THROW(tokenizeAndStringify("class B { using shared_ptr = std::shared_ptr; };\n" + "class D : public B { void f(const std::shared_ptr& ptr) {} };\n")); + } + void checkConfig(const char code[]) { errout.str("");