Neargye/semver

from_string() `invalid argument` exception

juliendz opened this issue · 5 comments

Hi,
I am trying to use from_string(). I am also using Qt.

Below code works fine:
semver::version version_in_db = semver::from_string(QString("1.0.0").toStdString());

But the below code fails with an exeption of 'invalid argument':
semver::version version_in_db = semver::from_string(QString("1.0.0-beta").toStdString());

Adding the '-beta' seems to be causing it to fail.

https://wandbox.org/permlink/5Kcebi882WSithlt
The version without QT looks working, can you please tell what is QString("1.0.0-beta").toStdString().size() ?

QString("1.0.0-beta").toStdString().size() outputs 10

Also I tested with the wandbox link with gcc 7.3.0 and its failed with exception. I am using MinGW 7.3 locally.

Indeed, GSS 9 and 8 are OK, GSS 7 falls with an error.
I will check later.

@juliendz Could you please check master branch? Looks like I found a way to fix it.

https://wandbox.org/permlink/5Kcebi882WSithlt gcc-7.3 and gcc-7.2 now ok.

Its working without exception on the master branch. Tested on MinGW 7.3. Thanks so much for the quick fix.