diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e3a8669..338289cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Version 183: * Fix a rare case of failed UTF8 validation * Verify certificates in client examples * Use boost::empty_value +* Workaround for http-server-fast and libstdc++ -------------------------------------------------------------------------------- diff --git a/doc/qbk/09_releases.qbk b/doc/qbk/09_releases.qbk index bd1ddb3a..91f30d58 100644 --- a/doc/qbk/09_releases.qbk +++ b/doc/qbk/09_releases.qbk @@ -21,6 +21,8 @@ * ([issue 1233]) Use [@boost:/doc/html/core/empty_value.html `boost::empty_value`] +* Workaround for http-server-fast and libstdc++ + [heading Boost 1.68] diff --git a/example/http/server/fast/Jamfile b/example/http/server/fast/Jamfile index 8a9dd44d..37d71b65 100644 --- a/example/http/server/fast/Jamfile +++ b/example/http/server/fast/Jamfile @@ -7,6 +7,10 @@ # Official repository: https://github.com/boostorg/beast # +# VFALCO _GLIBCXX_USE_CXX11_ABI is to work around +# a bug in libg++8 where it attempts to default-construct +# the allocator (even when it is not default constructible) + exe http-server-fast : http_server_fast.cpp : diff --git a/example/http/server/fast/fields_alloc.hpp b/example/http/server/fast/fields_alloc.hpp index e57fce74..a2126896 100644 --- a/example/http/server/fast/fields_alloc.hpp +++ b/example/http/server/fast/fields_alloc.hpp @@ -104,7 +104,7 @@ public: template struct fields_alloc { - detail::static_pool& pool_; + detail::static_pool* pool_; public: using value_type = T; @@ -122,39 +122,46 @@ public: using other = fields_alloc; }; +#if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) + // Workaround for g++ + // basic_string assumes that allocators are default-constructible + // See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437 + fields_alloc() = default; +#endif + explicit fields_alloc(std::size_t size) - : pool_(detail::static_pool::construct(size)) + : pool_(&detail::static_pool::construct(size)) { } fields_alloc(fields_alloc const& other) - : pool_(other.pool_.share()) + : pool_(&other.pool_->share()) { } template fields_alloc(fields_alloc const& other) - : pool_(other.pool_.share()) + : pool_(&other.pool_->share()) { } ~fields_alloc() { - pool_.destroy(); + pool_->destroy(); } value_type* allocate(size_type n) { return static_cast( - pool_.alloc(n * sizeof(T))); + pool_->alloc(n * sizeof(T))); } void deallocate(value_type*, size_type) { - pool_.dealloc(); + pool_->dealloc(); } #if defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 60000