On 2016-04-01 19:37, Peter Dimov wrote:
Steven Watanabe wrote:
On 04/01/2016 02:11 AM, Andrey Semashev wrote:
In my tests on gcc 6 I'm seeing these warnings which stem from >
Boost.Function:
../boost/function/function_template.hpp:572:11: warning: placement
new > constructing an object of type '<snip>'
and size '8' in a region of type 'char' and size '1' [-Wplacement-new=]
The 'char' in question is the first element of an array of sufficient size.
The buffer does have sufficient size but the char is not an array element. It's a char member of a union.
We could make this clearer by making function_buffer::data be an array with a sufficient size by, for instance, duplicating the definition of "union function_buffer" and taking its sizeof...
Thanks. I've made a patch with a similar idea: https://github.com/boostorg/function/pull/9 It passes tests on gcc 5.2 and MSVC-14, but unfortunately I don't have gcc 6 locally to verify that the warnings are actually gone.