diff --git a/include/boost/pfr/detail/fields_count.hpp b/include/boost/pfr/detail/fields_count.hpp index c3397b3b..bf9f1770 100644 --- a/include/boost/pfr/detail/fields_count.hpp +++ b/include/boost/pfr/detail/fields_count.hpp @@ -148,20 +148,34 @@ struct ubiq_rref_base_asserting { } }; -template ::value>> +template ::value and !std::is_aggregate_v>> constexpr auto assert_first_not_base(std::index_sequence) noexcept -> std::add_pointer_t{}, ubiq_lref_constructor{I}... })> { return nullptr; } -template ::value>> +template ::value and !std::is_aggregate_v>> constexpr auto assert_first_not_base(std::index_sequence) noexcept -> std::add_pointer_t{}, ubiq_rref_constructor{I}... })> { return nullptr; } +template ::value and std::is_aggregate_v>> +constexpr auto assert_first_not_base(std::index_sequence) noexcept + -> std::add_pointer_t{}, {ubiq_lref_constructor{I}}... })> +{ + return nullptr; +} + +template ::value and std::is_aggregate_v>> +constexpr auto assert_first_not_base(std::index_sequence) noexcept + -> std::add_pointer_t{}, {ubiq_rref_constructor{I}}... })> +{ + return nullptr; +} + template constexpr void* assert_first_not_base(std::index_sequence<>) noexcept { @@ -180,14 +194,22 @@ constexpr auto assert_first_not_base(long) noexcept ///////////////////// Helpers for initializable detection // Note that these take O(N) compile time and memory! -template ::value>> +template ::value and !std::is_aggregate_v>> constexpr auto enable_if_initializable_helper(std::index_sequence) noexcept -> std::add_pointer_t; -template ::value>> +template ::value and !std::is_aggregate_v>> constexpr auto enable_if_initializable_helper(std::index_sequence) noexcept -> std::add_pointer_t; +template ::value and std::is_aggregate_v>> +constexpr auto enable_if_initializable_helper(std::index_sequence) noexcept + -> std::add_pointer_t; + +template ::value and std::is_aggregate_v>> +constexpr auto enable_if_initializable_helper(std::index_sequence) noexcept + -> std::add_pointer_t; + template (detail::make_index_sequence()))> using enable_if_initializable_helper_t = U;