mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 02:08:09 +08:00
fix: do not use assert-only never reached branch
This commit is contained in:
@@ -157,9 +157,15 @@ parse_boolean(location& loc, const context<TC>& ctx)
|
|||||||
// it matches. gen value
|
// it matches. gen value
|
||||||
const auto str = reg.as_string();
|
const auto str = reg.as_string();
|
||||||
const auto val = [&str]() {
|
const auto val = [&str]() {
|
||||||
if (str == "true") { return true; }
|
if(str == "true")
|
||||||
else if(str == "false") { return false; }
|
{
|
||||||
else {assert("never reach here" && false);}
|
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 2: { return read_bin_int<T>(str, src); }
|
||||||
case 8: { return read_oct_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); }
|
case 16: { return read_hex_int<T>(str, src); }
|
||||||
default: { assert(false); }
|
default:
|
||||||
|
{
|
||||||
|
assert(base == 10);
|
||||||
|
return read_dec_int<T>(str, src);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user