boostorg / boostorg/pfr

Incorrect tuple_size if type contains native array member

Aperta
#170 1 commento 2 reazioni 0 assegnatari Vedi su GitHub
duplicate help wanted
Lingua principale
C++
Stelle
1.5k
Fork
176
Merge medio
5g 21h
PR unite (30g)
1

Descrizione

Reproduce:
```
struct Foo { int x[2]; };
```
gcc: 13.2.0
compile command: ` g++ -std=c++20 a.cpp -Ipath/to/boost`

Expect:
`expects(boost::pfr::tuple_size_v == 1);`
Actual:
`boost::pfr::tuple_size_v == 2`

Workaround(might be problematic, but works for me):
```patch
diff --git a/include/boost/pfr/detail/fields_count.hpp b/include/boost/pfr/detail/fields_count.hpp
index 8d1354e..04bb89c 100644
--- a/include/boost/pfr/detail/fields_count.hpp
+++ b/include/boost/pfr/detail/fields_count.hpp
@@ -150,11 +150,11 @@ constexpr void* assert_first_not_base(std::index_sequence<>) noexcept
///////////////////// Helper for SFINAE on fields count
template ::value>::type>
constexpr auto enable_if_constructible_helper(std::index_sequence) noexcept
- -> typename std::add_pointer::type;
+ -> typename std::add_pointer::type;

template ::value>::type>
constexpr auto enable_if_constructible_helper(std::index_sequence) noexcept
- -> typename std::add_pointer::type;
+ -> typename std::add_pointer::type;

template (detail::make_index_sequence()) ) >
using enable_if_constructible_helper_t = std::size_t;
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.