[Interest] QJSEngine won't evaluate octal literal

Hamish Moffatt hamish at risingsoftware.com
Tue Aug 3 08:36:19 CEST 2021


I have the following test code to evaluate an octal literal which I'm 
running on Qt 5.12 and 5.15;

             QJSEngine eng;
             auto jsv = eng.evaluate("(function(){return 011;})()");
             qDebug() << jsv.isError() << jsv.toString() << jsv.toVariant();

This outputs:

true "SyntaxError: Expected token `;'" QVariant(QVariantMap, QMap())


It works if I use hex literals, and the octal code works in node.js. Why 
doesn't it work in QJSEngine?


Hamish



More information about the Interest mailing list