catchorg / Clara

A simple to use, composable, command line parser for C++ 11 and beyond
Boost Software License 1.0
648 stars 67 forks source link

Parsing arguments with trailing garbage should fail #62

Open mjerabek opened 6 years ago

mjerabek commented 6 years ago

Integer arguments with trailing garbage are successfully decoded instead of giving an error: 42garbage is decoded as 42 instead of parse error

This will be also a problem for other types. I looked at the implementation and the fix should be quite simple -- just checking if the stringstream is empty after the conversion.

grafikrobot commented 4 years ago

Fixed in Lyra library with this change https://github.com/bfgroup/Lyra/commit/cdd5a924160402e7fb94736103e40cb64e0e27b1