diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d63c4a3..5df5ae2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,9 @@ jobs: fail-fast: false matrix: include: + - toolset: gcc-13 + cxxstd: "03,11,14,17,20" + os: ubuntu-22.04 - toolset: gcc-12 # Do not remove! It is the only toolset that tests misc/strip_boost_namespace.sh cxxstd: "03,11,14,17,2a" os: ubuntu-22.04 @@ -41,10 +44,7 @@ jobs: cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined" linkflags: "linkflags=--coverage -lasan -lubsan" gcov_tool: "gcov-9" - - toolset: clang-14 - cxxstd: "03,11,14,17,20" - os: ubuntu-22.04 - - toolset: clang-13 + - toolset: clang-15 cxxstd: "03,11,14,17,20" os: ubuntu-22.04 # - toolset: clang diff --git a/example/quick_examples.cpp b/example/quick_examples.cpp index 00e065b..7dd5734 100644 --- a/example/quick_examples.cpp +++ b/example/quick_examples.cpp @@ -106,18 +106,23 @@ void test_examples() { //] } -#if BOOST_PFR_CORE_NAME_ENABLED && BOOST_PFR_USE_CPP17 +// Disabling for MSVC as it gives a hard error on using local types: +// +// error C7631: +// 'boost::pfr::detail::do_not_use_PFR_with_local_types': +// variable with internal linkage declared but not defined +#if BOOST_PFR_CORE_NAME_ENABLED && BOOST_PFR_USE_CPP17 && !defined(_MSC_VER) { //[pfr_quick_examples_get_name // Get name of field by index struct sample { - int f1; - long f2; + int f_int; + long f_long; }; std::cout << boost::pfr::get_name<0, sample>() - << boost::pfr::get_name<1, sample>(); // Outputs: f1 f2 + << boost::pfr::get_name<1, sample>(); // Outputs: f_int f_long //] } #endif diff --git a/include/boost/pfr/detail/fake_object.hpp b/include/boost/pfr/detail/fake_object.hpp index 271ac19..df4bbd4 100644 --- a/include/boost/pfr/detail/fake_object.hpp +++ b/include/boost/pfr/detail/fake_object.hpp @@ -34,7 +34,7 @@ struct wrapper { // This variable servers as a link-time assert. // If linker requires it, then `fake_object()` is used at runtime. template -extern const wrapper report_if_you_see_link_error_with_this_object; +extern const wrapper do_not_use_PFR_with_local_types; // For returning non default constructible types, it's exclusively used in member name retrieval. // @@ -43,7 +43,7 @@ extern const wrapper report_if_you_see_link_error_with_this_object; // with the former standards. template constexpr const T& fake_object() noexcept { - return report_if_you_see_link_error_with_this_object.value; + return do_not_use_PFR_with_local_types.value; } }}} // namespace boost::pfr::detail diff --git a/test/core_name/run/fields_names.cpp b/test/core_name/run/fields_names.cpp index 689d023..e04a44a 100644 --- a/test/core_name/run/fields_names.cpp +++ b/test/core_name/run/fields_names.cpp @@ -58,6 +58,12 @@ void test_get_name_by_id() { } void test_get_name_by_id_without_linkage() { +// Disabling for MSVC as it gives a hard error on using local types: +/// +// error C7631: +// 'boost::pfr::detail::do_not_use_PFR_with_local_types': +// variable with internal linkage declared but not defined +#ifndef _MSC_VER struct function_local { int val; }; @@ -68,6 +74,7 @@ void test_get_name_by_id_without_linkage() { BOOST_TEST_EQ( ((boost::pfr::get_name<0, inside_unnamed_ns>())), "hidden"); BOOST_TEST_EQ( ((boost::pfr::get_name<0, function_local>())), "val"); +#endif } void test_get_name_by_type() { @@ -100,6 +107,12 @@ void test_names_as_array() { } void test_names_as_array_without_linkage() { +// Disabling for MSVC as it gives a hard error on using local types: +/// +// error C7631: +// 'boost::pfr::detail::do_not_use_PFR_with_local_types': +// variable with internal linkage declared but not defined +#ifndef _MSC_VER const auto expected = std::array{ "unnamed_first", "unnamed_second" @@ -109,6 +122,7 @@ void test_names_as_array_without_linkage() { for (std::size_t i=0;i