diff --git a/toml/parser.hpp b/toml/parser.hpp index c36dd53..97dadee 100644 --- a/toml/parser.hpp +++ b/toml/parser.hpp @@ -868,6 +868,13 @@ parse_array(location& 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(loc, first, loc.iter()), + "inhomogenous types")); + } retval.push_back(std::move(val.unwrap())); } else