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 09ca7c7 commit 8e60d94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions example/quick_examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ void test_examples() {
}

// Disabling for MSVC as it gives a hard error on using local types:
// error C7631: 'boost::pfr::detail::report_if_you_see_link_error_with_this_object<test_examples::sample>': variable with internal linkage declared but not defined
#if BOOST_PFR_CORE_NAME_ENABLED && BOOST_PFR_USE_CPP17
///
// 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
Expand Down
4 changes: 2 additions & 2 deletions include/boost/pfr/detail/fake_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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> if_you_see_error_with_this_object_then_do_not_use_PFR_with_local_types;
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.
//
Expand All @@ -43,7 +43,7 @@ extern const wrapper<T> if_you_see_error_with_this_object_then_do_not_use_PFR_wi
// with the former standards.
template <class T>
constexpr const T& fake_object() noexcept {
return if_you_see_error_with_this_object_then_do_not_use_PFR_with_local_types<T>.value;
return do_not_use_PFR_with_local_types<T>.value;
}

}}} // namespace boost::pfr::detail
Expand Down

0 comments on commit 8e60d94

Please sign in to comment.