虚函数打桩失败
xinxijishuwyq opened this issue · comments
EMOCK((bool (QFile::*)(QFile::OpenMode))&QFile::open)
.stubs()
.will(returnValue(true));
terminate called after throwing an instance of 'emock::Exception'
what(): Failed to get address of [(bool (QFile::*)(QFile::OpenMode))&QFile::open], maybe inlined or haven't been overridden in derived class.
是在Windows环境吗
是在Windows环境吗
archlinux
gcc12.2.0
是不支持linux吗,还是我使用方法有问题
EMOCK((bool (*) (QFile*,QFile::OpenMode)) ((bool (QFile::*)(QFile::OpenMode))&QFile::open))
.stubs()
.will(invoke(mock_bar1));
参考了cpp-stub的做法,把成员函数指针强制转换成普通指针就好了--