Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
apolukhin committed Feb 15, 2024
1 parent 8e60d94 commit 942e2a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions example/quick_examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void test_examples() {
}

// 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
Expand All @@ -117,12 +117,12 @@ void test_examples() {
// 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
Expand Down
7 changes: 7 additions & 0 deletions test/core_name/run/fields_names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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() {
Expand Down

0 comments on commit 942e2a0

Please sign in to comment.