diff --git a/examples/srcloctest.cpp b/examples/srcloctest.cpp index a3014676..4e65e3fa 100644 --- a/examples/srcloctest.cpp +++ b/examples/srcloctest.cpp @@ -108,7 +108,7 @@ int main(int argc, char **argv) "7. types in named and anonymous namespaces", conjure_type::tpeek(), conjure_type::tpeek(), - conjure_type::tpeek(), + conjure_type::tpeek(), "", "8. other types", conjure_type::tpeek(), conjure_type::tpeek(), diff --git a/include/fix8/conjure_enum.hpp b/include/fix8/conjure_enum.hpp index b7e7abfe..65adf4df 100644 --- a/include/fix8/conjure_enum.hpp +++ b/include/fix8/conjure_enum.hpp @@ -97,7 +97,7 @@ class cs { "e = ", ';', "", '<' }, { "T = ", ']', "{anonymous}", '{' }, #elif defined _MSC_VER { "epeek<", '>', "`anonymous-namespace'", '`' }, { "::tpeek", '<', "`anonymous-namespace'::", '`' }, - { "", '\0', "enum ", '\0' }, { "", '\0', "class ", '\0' }, + { "", '\0', "enum ", '\0' }, { "", '\0', "class ", '\0' }, { "", '\0', "struct ", '\0' }, //{ "epeek<", '>', "`anonymous-namespace'", '`' }, { "enum ", '>', "enum `anonymous-namespace'", '`' }, { "class ", '>', "", 0 }, #else # error "conjure_enum not supported by your compiler" @@ -113,7 +113,7 @@ class cs cs(cs&&) = delete; cs& operator=(cs&&) = delete; - enum class stype { enum_t, type_t, extype_t0, extype_t1 }; + enum class stype { enum_t, type_t, extype_t0, extype_t1, extype_t2 }; enum class sval { start, end, anon_str, anon_start }; template // can't have constexpr decompositions! (but why not?) @@ -749,12 +749,13 @@ class conjure_type if constexpr (constexpr auto lc { from.find_first_of(cs::get_spec()) }; lc != std::string_view::npos) { constexpr std::string_view e1 { from.substr(lc, ep - lc - 1) }; - if constexpr (constexpr auto ep1 { e1.find(cs::get_spec()) }; ep1 != std::string_view::npos) - return e1.substr(ep1 + cs::get_spec().size(), e1.size() - ep1 - cs::get_spec().size()); - if constexpr (constexpr auto ep1 { e1.find(cs::get_spec()) }; ep1 != std::string_view::npos) - return e1.substr(ep1 + cs::get_spec().size(), e1.size() - ep1 - cs::get_spec().size()); - if constexpr (constexpr auto ep1 { e1.find(cs::get_spec()) }; ep1 != std::string_view::npos) - return e1.substr(ep1 + cs::get_spec().size(), e1.size() - ep1 - cs::get_spec().size()); +#define _chkstr(x) \ + if constexpr (constexpr auto ep1 { e1.find(cs::get_spec()) }; ep1 != std::string_view::npos) \ + return e1.substr(ep1 + cs::get_spec().size(), e1.size() - ep1 - cs::get_spec().size()) + _chkstr(type_t); + _chkstr(extype_t0); + _chkstr(extype_t1); + _chkstr(extype_t2); } return {}; }