Skip to content

Instantly share code, notes, and snippets.

@xiangchu0
Created September 9, 2017 07:30
Show Gist options
  • Select an option

  • Save xiangchu0/83db427de20d29fb2d7dca6e13121994 to your computer and use it in GitHub Desktop.

Select an option

Save xiangchu0/83db427de20d29fb2d7dca6e13121994 to your computer and use it in GitHub Desktop.
placement new issues with 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=]
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)];
};
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment