mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 02:08:09 +08:00
show error message for inhomogenous array
This commit is contained in:
@@ -868,6 +868,13 @@ parse_array(location<Container>& loc)
|
|||||||
|
|
||||||
if(auto val = parse_value(loc))
|
if(auto val = parse_value(loc))
|
||||||
{
|
{
|
||||||
|
if(!retval.empty() && retval.front().type() != val.as_ok().type())
|
||||||
|
{
|
||||||
|
throw syntax_error(format_underline(
|
||||||
|
"[error] toml::parse_array: type of elements should be the "
|
||||||
|
"same each other.", region<Container>(loc, first, loc.iter()),
|
||||||
|
"inhomogenous types"));
|
||||||
|
}
|
||||||
retval.push_back(std::move(val.unwrap()));
|
retval.push_back(std::move(val.unwrap()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user