[Interest] error: taking address of temporary [-fpermissive]

John Weeks john at wavemetrics.com
Fri Jun 1 20:54:44 CEST 2012


On 01-Jun-2012, at 11:40 AM, Robert Wood wrote:

> &ui->dateInDateEdit->date()

That creates a QDate and takes its address. Presumably, if the code works, sqlFormatString() isn't altering the input. I think you can fix it by changing

QString enter_invoice_in::sqlFormatString(QDate *date);

to

QString enter_invoice_in::sqlFormatString(const QDate *date);

Or you can assign the QDate to a variable and then pass the address of that variable:

QDate aDate = ui->dateInDateEdit->date();
queryString += "\"" + sqlFormatString(&aDate) + "\",";

-John Weeks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120601/80aff352/attachment.html>


More information about the Interest mailing list