Open qqnnhhdmp opened 10 months ago
{ // In block scope: struct Callbacks { virtual ~Callbacks() = default; virtual auto on_ball_pocketed(nbs::eightball::BallId ball_id_) -> void = 0; }; using namespace fakeit; Mock<Callbacks> mock_callbacks; When(Method(mock_callbacks, on_ball_pocketed)).Return(); pool.on_ball_pocketed = [&mock_callbacks](auto &&_1) { return mock_callbacks.get().on_ball_pocketed(_1); }; Verify(Method(mock_callbacks, on_ball_pocketed)).Exactly(1); }
Error: error C3640: “CATCH2_INTERNAL_TEST_22::Callbacks::[thunk]: cdecl `void cdecl CATCH2_INTERNAL_TEST_22(void)'::2'::Callbacks::vcall'{8,{flat}}' }'”: 局部类的引用成员函数或虚拟成员函数必须进行定义
error C3640: “CATCH2_INTERNAL_TEST_22::Callbacks::[thunk]: cdecl `void cdecl CATCH2_INTERNAL_TEST_22(void)'::2'::Callbacks::vcall'{8,{flat}}' }'”: 局部类的引用成员函数或虚拟成员函数必须进行定义
2'::Callbacks::
Translation of above chinese:
Reference member function or virtual member function of local class must be defined.
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-2/compiler-error-c3640?view=msvc-170
It looks like it's a limitation of MSVC (or C++ itself, I don't know). You can provide an empty definition for the function and it should work I guess.
Error:
error C3640: “CATCH2_INTERNAL_TEST_22::Callbacks::[thunk]: cdecl `void cdecl CATCH2_INTERNAL_TEST_22(void)'::
2'::Callbacks::
vcall'{8,{flat}}' }'”: 局部类的引用成员函数或虚拟成员函数必须进行定义Translation of above chinese:
Reference member function or virtual member function of local class must be defined.