mirror of
https://github.com/boostorg/pfr.git
synced 2026-01-19 04:22:13 +00:00
CI fixes (#161)
This commit is contained in:
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -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
|
||||
|
||||
@@ -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<test_examples::sample>':
|
||||
// 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
|
||||
|
||||
@@ -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 <class T>
|
||||
extern const wrapper<T> report_if_you_see_link_error_with_this_object;
|
||||
extern const wrapper<T> 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<T> report_if_you_see_link_error_with_this_object;
|
||||
// with the former standards.
|
||||
template <class T>
|
||||
constexpr const T& fake_object() noexcept {
|
||||
return report_if_you_see_link_error_with_this_object<T>.value;
|
||||
return do_not_use_PFR_with_local_types<T>.value;
|
||||
}
|
||||
|
||||
}}} // namespace boost::pfr::detail
|
||||
|
||||
@@ -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<testing::unnamed_t>':
|
||||
// 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<testing::unnamed_t>':
|
||||
// variable with internal linkage declared but not defined
|
||||
#ifndef _MSC_VER
|
||||
const auto expected = std::array<std::string_view, 2>{
|
||||
"unnamed_first",
|
||||
"unnamed_second"
|
||||
@@ -109,6 +122,7 @@ void test_names_as_array_without_linkage() {
|
||||
for (std::size_t i=0;i<expected.size();++i) {
|
||||
BOOST_TEST_EQ(value[i], expected[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void test_names_as_array_for_empty() {
|
||||
|
||||
Reference in New Issue
Block a user