What version of GCC and what is the error message?
My GCC 4.5.3, Qt 4.7.4 on Linux produces no error or warning on this:
#include <QtCore>
#include <QDebug>
void myfunction(const QHash<QString, QVariant> &callback = QHash<QString, QVariant>())
{
qDebug() << callback.keys();
}
int main(int argc, char *argv[])
{
myfunction();
QHash<QString, QVariant> h;
myfunction(h);
return 0;
}
#include <QtCore>
#include <QDebug>
void myfunction(const QHash<QString, QVariant> &callback = QHash<QString, QVariant>())
{
qDebug() << callback.keys();
}
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
myfunction();
QHash<QString, QVariant> h;
h.insert("A", QVariant(1));
h.insert("B", QVariant(1));
myfunction(h);
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks