Boost.Log Expressions v1.71 will not compile under C++20

Viewed 255

Including the <boost/log/expressions.hpp> header under C++20 (only tested under gcc 10.1), causes a compilation failure:

/celibs/boost_1_71_0/boost/log/attributes/named_scope.hpp:128:29: error: 'reference' in 'boost::log::v2s_mt_posix::attributes::named_scope_list::allocator_type' {aka 'class std::allocator<boost::log::v2s_mt_posix::attributes::named_scope_entry>'} does not name a type

  128 |     typedef allocator_type::reference reference;
      |                             ^~~~~~~~~
...

The code sample used is from Boost's own examples. Switching to C++17 or Boost v1.73 allows compilation to succeed. Looking at the Boost.Log v1.73 changelog, there's this entry:

Ported various components of the library to std::allocator_traits to improve compatibility with C++20 allocators.

The 'improve compatibility with' part implies that there's a way of making it work, does anyone know a workaround? I'd rather not have to upgrade to v1.73.

0 Answers
Related