fix: add detail::make_error_info_rec overload

that converts basic_value to location
This commit is contained in:
ToruNiina 2024-07-02 23:34:20 +09:00
parent ccd941dc5b
commit d4742334ce
2 changed files with 12 additions and 0 deletions

View File

@ -41,6 +41,10 @@ struct error_info
std::string suffix_; // hint or something like that
};
// forward decl
template<typename TypeConfig>
class basic_value;
namespace detail
{
inline error_info make_error_info_rec(error_info e)
@ -53,6 +57,10 @@ inline error_info make_error_info_rec(error_info e, std::string s)
return e;
}
template<typename TC, typename ... Ts>
error_info make_error_info_rec(error_info e,
const basic_value<TC>& v, std::string msg, Ts&& ... tail);
template<typename ... Ts>
error_info make_error_info_rec(error_info e,
source_location loc, std::string msg, Ts&& ... tail)

View File

@ -2026,12 +2026,16 @@ operator>=(const basic_value<TC>& lhs, const basic_value<TC>& rhs)
}
// error_info helper
namespace detail
{
template<typename TC, typename ... Ts>
error_info make_error_info_rec(error_info e,
const basic_value<TC>& v, std::string msg, Ts&& ... tail)
{
return make_error_info_rec(std::move(e), v.location(), std::move(msg), std::forward<Ts>(tail)...);
}
} // detail
template<typename TC, typename ... Ts>
error_info make_error_info(
std::string title, const basic_value<TC>& v, std::string msg, Ts&& ... tail)