Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
6.4.2
-
None
Description
Sample/Pseudo code;
QJsonObject m_obj; void updateJson(const QJsonValue &val) {m_obj["key"] = val;} void set1(const QStringList &val) { updateJson(QJsonArray::fromStringList(val)); } void set2(const QStringList &val) { QJsonArray tObj = QJsonArray::fromStringList(val); updateJson(tObj); } QStringList get() const { return m_obj["key"].toVariant().toStringList(); } main (){ set1({"testing"}); qDebug() << get(); // CLANG: QVariant(QVariantList, QList(QVariant(QString, "testing"))) // GCC: QVariant(QVariantList, QList(QVariant(QString, "testing"))) set2({"testing"}); qDebug() << get(); // CLANG: QVariant(QVariantList, QList(QVariant(QString, "testing"))) // GCC: QVariant(QVariantList, QList(QVariant(QVariantList, QList(QVariant(QString, "testing"))))) }
Seems like compilers select different paths.
https://godbolt.org/z/WqPfhTbM4
Attachments
Issue Links
- is duplicated by
-
QTBUG-99152 QJsonDocument::array() returns a repeatly encapsulated QJsonArray
- Closed