Parsing version string "1.0.1-alpha.5-114-ga2f3905" yields Invalid argument error

#53 · closed · 1 comments

View on GitHub ↗

LennartSchu

Hello! When parsing the version string "1.0.1-alpha.5-114-ga2f3905", semver yields an unexpected error. e.g. the code snippet ``` semver::version version; const auto [ptr, ec] = semver::parse("1.0.1-alpha.5-114-ga2f3905", version); std::cout << std::strerror(static_cast<int>(ec)) << std::endl; ``` yields ``` Invalid argument ``` even though it is a valid version. My guess is that this is due to the "0" in the prerelease-identifier of the version string ("ga2f3905"). When removing it, the version string is correctly parsed. Debugging the code, the error seems to be caused by the function `parse_prerelease_identifier`, which enforces the rule that such an identifier cannot start with `0`. Could you fix this issue? Regards

Comments

Naratzul

Hi! Thanks for reporting this issue. I will review your pull request shortly