diff --git a/include/boost/pfr/detail/core_name20_static.hpp b/include/boost/pfr/detail/core_name20_static.hpp index 8954315..7ab7a5a 100644 --- a/include/boost/pfr/detail/core_name20_static.hpp +++ b/include/boost/pfr/detail/core_name20_static.hpp @@ -40,7 +40,7 @@ consteval auto name_of_field_impl() noexcept { constexpr std::string_view sv = __PRETTY_FUNCTION__; constexpr auto last = sv.find_last_not_of(" ])}"); #endif - constexpr auto first = sv.find_last_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789", last); + constexpr auto first = sv.find_last_of(".:->", last); auto res = std::array{}; std::ranges::copy(sv.begin()+first+1, sv.begin()+last+1, diff --git a/test/core_name/Jamfile.v2 b/test/core_name/Jamfile.v2 index c787391..c95538e 100644 --- a/test/core_name/Jamfile.v2 +++ b/test/core_name/Jamfile.v2 @@ -44,23 +44,20 @@ project ; -########## BEGIN of helpers to prepare the test with non-ascii field name -# TODO: fix it -# actions insert_utf8_action -# { -# sed 's/%ARG%/\xcf\x80/' $(>) > $(<) -# } -# make fields_names_nonascii.cpp : fields_names_nonascii.cpp.tpl : @insert_utf8_action ; +actions invoke_python_generator +{ + python $(>) > $(<) +} -########## END of helpers to prepare the test with non-ascii field name +make fields_names_nonascii.cpp : generate_fields_names_nonascii.cpp.py : @invoke_python_generator ; test-suite pfr_tests : [ run fields_names.cpp : : : : ] [ run fields_names_constexpr.cpp : : : : ] - # [ run fields_names_nonascii.cpp : : : : ] + [ run fields_names_nonascii.cpp : : : msvc:"/utf-8" : ] ; diff --git a/test/core_name/fields_names_nonascii.cpp.tpl b/test/core_name/fields_names_nonascii.cpp.tpl deleted file mode 100644 index 972b064..0000000 --- a/test/core_name/fields_names_nonascii.cpp.tpl +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2023 Bela Schaum, X-Ryl669, Denis Mikhailov. -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - - -// Initial implementation by Bela Schaum, https://github.com/schaumb -// The way to make it union and UB free by X-Ryl669, https://github.com/X-Ryl669 -// - -#include - -#include - -namespace testing { - -struct Aggregate { - int _%ARG%; -}; - -void test_get_name() { - BOOST_TEST_EQ( ((boost::pfr::get_name<0, Aggregate>())), "_%ARG%"); -} - -void test_names_as_array() { - const auto expected = std::array{ - "_%ARG%" - }; - const auto value = boost::pfr::names_as_array(); - BOOST_TEST_EQ(expected.size(), value.size()); - for (std::size_t i=0;i + +#include + +namespace testing { + +struct Aggregate { + int _%ARG%; +}; + +void test_get_name() { + BOOST_TEST_EQ( ((boost::pfr::get_name<0, Aggregate>())), "_%ARG%"); +} + +void test_names_as_array() { + const auto expected = std::array{ + "_%ARG%" + }; + const auto value = boost::pfr::names_as_array(); + BOOST_TEST_EQ(expected.size(), value.size()); + for (std::size_t i=0;i