Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

尝试对QTextStream的符号重载函数打桩失败 #36

Open
xinxijishuwyq opened this issue Dec 19, 2022 · 1 comment
Open

尝试对QTextStream的符号重载函数打桩失败 #36

xinxijishuwyq opened this issue Dec 19, 2022 · 1 comment

Comments

@xinxijishuwyq
Copy link

尝试对QTextStream的符号重载函数打桩失败
QTextStream& (*addrQTSOperator) (QTextStream*,const QString&)=(QTextStream& (*) (QTextStream*,const QString&)) ((QTextStream& (QTextStream::*)(const QString&))&QTextStream::operator<<); EMOCK(addrQTSOperator) .stubs() .will(invoke(mock_QTSOperator));
QTextStream& EMOCK_API mock_QTSOperator(QTextStream* obj,const QString& s) { auto fileName=((QFile*)(obj->device()))->fileName(); qDebug()<<fileName; qDebug()<<s; return *obj; }
报错如下:
/home/ken/tstPluginSaveRuntime/lemock/include/emock/IsEqual.h:42: error: use of deleted function ‘QTextStream::QTextStream(const QTextStream&)’ lemock/include/emock/IsEqual.h:45:25: required from ‘bool emock::IsEqual<T>::eval(const emock::RefAny&) const [with T = QTextStream]’ lemock/include/emock/IsEqual.h:42:10: required from here lemock/include/emock/types/AnyCast.h:155:38: error: use of deleted function ‘QTextStream::QTextStream(const QTextStream&)’ 155 | return *const_cast<nonref*>(result); | ^ /usr/include/qt/QtCore/qtextstream.h:195:20: note: declared here 195 | Q_DISABLE_COPY(QTextStream) | ^~~~~~~~~~~ /usr/include/qt/QtCore/qglobal.h:443:5: note: in definition of macro ‘Q_DISABLE_COPY’ 443 | Class(const Class &) = delete;\ | ^~~~~

@orca-zhang
Copy link
Member

看报错是说拷贝构造函数被禁用,我晚点看下AnyCast.h的155行是啥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants