@@ -2123,3 +2123,31 @@ TEST(FunctionReflectionTest, UndoTest) {
21232123#endif
21242124#endif
21252125}
2126+
2127+ TEST (FunctionReflectionTest, FailingTest1) {
2128+ Cpp::CreateInterpreter ();
2129+ EXPECT_FALSE (Cpp::Declare (R"(
2130+ class WithOutEqualOp1 {};
2131+ class WithOutEqualOp2 {};
2132+
2133+ WithOutEqualOp1 o1;
2134+ WithOutEqualOp2 o2;
2135+
2136+ template<class C1, class C2>
2137+ bool is_equal(const C1& c1, const C2& c2) { return (bool)(c1 == c2); }
2138+ )" ));
2139+
2140+ Cpp::TCppType_t o1 = Cpp::GetTypeFromScope (Cpp::GetNamed (" o1" ));
2141+ Cpp::TCppType_t o2 = Cpp::GetTypeFromScope (Cpp::GetNamed (" o2" ));
2142+ std::vector<Cpp::TCppFunction_t> fns;
2143+ Cpp::GetClassTemplatedMethods (" is_equal" , Cpp::GetGlobalScope (), fns);
2144+ EXPECT_EQ (fns.size (), 1 );
2145+
2146+ Cpp::TCppScope_t fn = Cpp::BestOverloadFunctionMatch (fns, {}, {o1, o2});
2147+ EXPECT_TRUE (fn);
2148+ Cpp::JitCall jit_call = Cpp::MakeFunctionCallable (fn);
2149+ EXPECT_EQ (jit_call.getKind (), Cpp::JitCall::kUnknown ); // expected to fail
2150+ EXPECT_FALSE (Cpp::Declare (" int x = 1;" )); // expected to pass, but fails
2151+ EXPECT_FALSE (Cpp::Declare (
2152+ " int y = 1;" )); // expected to pass, and passes on second attempt
2153+ }
0 commit comments