Hello, there are a more than one way to initialize a QStringList but
sometimes they are not equal, consider this console app:
main.cpp:
#include <QCoreApplication>
#include "qcommandlineparser.h"
#include "qdebug.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QCommandLineParser lp;
QCommandLineOption o1(QStringList() << "o" << "ok");
QCommandLineOption o2(QStringList{"a","alsook"});
QCommandLineOption o3(QStringList("yesok"));
qDebug() << "geronimo";
QCommandLineOption o4(QStringList("g","goessouth"));
qDebug() << "landed";
lp.addOptions({o1,o2,o3,o4});
}
If I build it in debug mode on 6.8.2, either with MSVC 2022 or gcc
version 13.3.0 on Ubuntu and run it:
18:57:31: Starting
/home/henry/untitled/build/Desktop_Qt_6_8_2-Debug/untitled...
geronimo
ASSERT: "this->isMutable() || b == e" in file
/home/henry/Qt/6.8.2/gcc_64/include/QtCore/qarraydataops.h, line 884
18:57:32: The process crashed.
In release mode:
19:12:47: Starting
/home/henry/untitled/build/Desktop_Qt_6_8_2-Release/untitled...
geronimo
landed
QCommandLineParser: already having an option named "a"
19:12:47: /home/henry/untitled/build/Desktop_Qt_6_8_2-Release/untitled
exited with code 0
Obviously I am doing something wrong when setting o4 but it would be
nice if I could get a compile error...
Rgrds Henry
--
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development