From 3088f0169c957bc2fe7af71591c6c8e1b0490552 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 19 Dec 2020 20:14:56 +0000 Subject: Forbid templates in type_names helper They return different names WRT default template arguments on different compilers. --- icespider/core/util.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/icespider/core/util.h b/icespider/core/util.h index ca1350b..406faba 100644 --- a/icespider/core/util.h +++ b/icespider/core/util.h @@ -49,10 +49,12 @@ template struct type_names { static constexpr auto name() { - const std::string_view with_T {"T = "}; - const auto start {pf().find(with_T) + with_T.length()}; - const auto end {pf().find(']', start)}; - return pf().substr(start, end - start); + constexpr std::string_view with_T {"T = "}; + constexpr auto start {pf().find(with_T) + with_T.length()}; + constexpr auto end {pf().find(']', start)}; + constexpr auto name {pf().substr(start, end - start)}; + static_assert(name.find('<') == std::string_view::npos, "Templates not supported"); + return name; } static constexpr auto -- cgit v1.2.3