placement new issues with gcc6
Closed this issue · 4 comments
This project does not compile with gcc6 (at least on FreeBSD 10), apparently because of a new issue detection mechanism implemented in gcc6.
There seems to be a misunderstanding in the following parts.
src/boost/function/function_template.hpp
at line 572
src/boost/function/function_base.hpp
at line 308
Here are the errors as reported by gcc:
src/boost/function/function_template.hpp:572:11: error: placement new constructing an object of type 'network_boost::algorithm::detail::token_finderF<network::detail::normalize_path_segments(network::string_view)::<lambda(char)> >' and size '8' in a region of type 'char' and size '1' [-Werror=placement-new=]
src/boost/function/function_base.hpp:308:13: error: placement new constructing an object of type 'network_boost::detail::function::functor_manager_common<network_boost::algorithm::detail::token_finderF<network::detail::normalize_path_segments(network::string_view)::<lambda(char)> > >::functor_type {aka network_boost::algorithm::detail::token_finderF<network::detail::normalize_path_segments(network::string_view)::<lambda(char)> >}' and size '8' in a region of type 'char' and size '1' [-Werror=placement-new=]
Sadly, I'm not familiar enough with this 'new placement' thing to understand what the heck is going on here.
It's just a warning, so it should be possible to compile it anyway, but not without disabling the "warning as error" option.
It's apparently something boost needs to address. Here's what I did to shut the compiler up.
Index: src/boost/function/function_base.hpp
===================================================================
--- src/boost/function/function_base.hpp (revision 63563)
+++ src/boost/function/function_base.hpp (working copy)
@@ -120,8 +120,8 @@
bool is_volatile_qualified;
} obj_ref;
- // To relax aliasing constraints
- mutable char data;
+ // To relax aliasing constraints (HACK - I'm making data at least as big as the things above to avoid a placement-new error we're getting with gcc6. Not sure if that makes this comment now irrelevant)
+ mutable char data[sizeof(bound_memfunc_ptr_t)];
};
/**
I receive the same error on Ubuntu 14.04 with gcc 6.2.0 and I can confirm that @ddurham2's patch fixes the issue.
BTW: why there are boost sources (probably outdated?) in src/boost
subdirectory? Are they needed/shouldn't they be in a submodule? As far as I can see the implementation of function_base.hpp
has slightly changed with respect to the one in the repository.
EDIT
I've just noticed that this fork https://github.com/reBass/uri already removed boost sources and added usual find_package(Boost 1.54.0 REQUIRED)
to CMakeLists.txt
: maybe it's worth checking this out and merging?
Fixed on master.