2

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.

cmannett85
  • 21,725
  • 8
  • 76
  • 119
  • Or, it implies that it is a work in progress. Please test with 1.73 and/or file a bug report. You're doing bleeding edge compilers, you will be expected to upgrade libraries for the necessary compatibility changes. – sehe Jul 03 '20 at 23:26
  • There is no workaround. If you want to use C++20, you have to either upgrade or patch 1.71 to use `std::allocator_traits`. – Andrey Semashev Jul 04 '20 at 08:46

0 Answers0