Neargye / semver

Semantic Versioning for modern C++
MIT License
296 stars 32 forks source link

from_string() `invalid argument` exception #5

Closed juliendz closed 4 years ago

juliendz commented 4 years ago

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.

Neargye commented 4 years ago

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

juliendz commented 4 years ago

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.

Neargye commented 4 years ago

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

Neargye commented 4 years ago

@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.

juliendz commented 4 years ago

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