boostorg / hana

Your standard library for metaprogramming
http://boostorg.github.io/hana
Boost Software License 1.0
1.7k stars 216 forks source link

BOOST_HANA_ADAPT_STRUCT default max members decreased, breaking backwards compatibility #493

Closed joseph-ireland closed 2 years ago

joseph-ireland commented 3 years ago

It seems that since commit b6807015f1d3bee2eb4d204, boost/hana/detail/struct_macros.hpp went from being generated with

export MAX_NUMBER_OF_MEMBERS=55; erb struct_macros.hpp.erb

to

erb struct_macros.hpp.erb

which resulted in the MAX_NUMBER_OF_MEMBERS defaulting to 40. This has broken backwards compatibility with older boost releases.

Also the error for overflowing MAX_NUMBER_OF_MEMBERS is quite cryptic:

/path/to/example.cpp:904:1: error: pasting "BOOST_HANA_ADAPT_ADT_IMPL_" and "(" does not give a valid preprocessing token
 BOOST_HANA_ADAPT_ADT(foo,
 ^

Maybe the smaller macros like BOOST_HANA_PP_NARG could have a higher limit to get a more sensible error like

error: use of undeclared identifier 'BOOST_HANA_ADAPT_ADT_IMPL_46'