mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-23 12:50:06 +00:00
fix: do not use assert-only never reached branch
This commit is contained in:
parent
872ef72572
commit
6f05bffb5f
@ -157,9 +157,15 @@ parse_boolean(location& loc, const context<TC>& ctx)
|
||||
// it matches. gen value
|
||||
const auto str = reg.as_string();
|
||||
const auto val = [&str]() {
|
||||
if (str == "true") { return true; }
|
||||
else if(str == "false") { return false; }
|
||||
else {assert("never reach here" && false);}
|
||||
if(str == "true")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(str == "false");
|
||||
return false;
|
||||
}
|
||||
}();
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -147,9 +147,12 @@ read_int(const std::string& str, const source_location src, const std::uint8_t b
|
||||
{
|
||||
case 2: { return read_bin_int<T>(str, src); }
|
||||
case 8: { return read_oct_int<T>(str, src); }
|
||||
case 10: { return read_dec_int<T>(str, src); }
|
||||
case 16: { return read_hex_int<T>(str, src); }
|
||||
default: { assert(false); }
|
||||
default:
|
||||
{
|
||||
assert(base == 10);
|
||||
return read_dec_int<T>(str, src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user