4141# pragma warning( push )
4242# pragma warning( disable : 4793 ) // complaint about native code generation
4343# pragma warning( disable : 4127 ) // "conditional expression is constant"
44- #endif
44+ #endif
4545
4646// Define BOOST_FUNCTION_STD_NS to the namespace that contains type_info.
4747#ifdef BOOST_NO_STD_TYPEINFO
@@ -120,8 +120,11 @@ namespace network_boost {
120120 bool is_volatile_qualified;
121121 } obj_ref;
122122
123- // To relax aliasing constraints
124- mutable char data;
123+ // To relax aliasing constraints (HACK - I'm making data at
124+ // least as big as the things above to avoid a placement-new
125+ // error we're getting with gcc6. Not sure if that makes this
126+ // comment now irrelevant)
127+ mutable char data[sizeof (bound_memfunc_ptr_t )];
125128 };
126129
127130 /* *
@@ -188,11 +191,11 @@ namespace network_boost {
188191 struct reference_manager
189192 {
190193 static inline void
191- manage (const function_buffer& in_buffer, function_buffer& out_buffer,
194+ manage (const function_buffer& in_buffer, function_buffer& out_buffer,
192195 functor_manager_operation_type op)
193196 {
194197 switch (op) {
195- case clone_functor_tag:
198+ case clone_functor_tag:
196199 out_buffer.obj_ref = in_buffer.obj_ref ;
197200 return ;
198201
@@ -207,13 +210,13 @@ namespace network_boost {
207210
208211 case check_functor_type_tag:
209212 {
210- const detail::sp_typeinfo& check_type
213+ const detail::sp_typeinfo& check_type
211214 = *out_buffer.type .type ;
212215
213216 // Check whether we have the same type. We can add
214217 // cv-qualifiers, but we can't take them away.
215218 if (BOOST_FUNCTION_COMPARE_TYPE_ID (check_type, BOOST_SP_TYPEID (F))
216- && (!in_buffer.obj_ref .is_const_qualified
219+ && (!in_buffer.obj_ref .is_const_qualified
217220 || out_buffer.type .const_qualified )
218221 && (!in_buffer.obj_ref .is_volatile_qualified
219222 || out_buffer.type .volatile_qualified ))
@@ -240,9 +243,9 @@ namespace network_boost {
240243 struct function_allows_small_object_optimization
241244 {
242245 BOOST_STATIC_CONSTANT
243- (bool ,
246+ (bool ,
244247 value = ((sizeof (F) <= sizeof (function_buffer) &&
245- (alignment_of<function_buffer>::value
248+ (alignment_of<function_buffer>::value
246249 % alignment_of<F>::value == 0 ))));
247250 };
248251
@@ -254,7 +257,7 @@ namespace network_boost {
254257 A (a)
255258 {
256259 }
257-
260+
258261 functor_wrapper (const functor_wrapper& f) :
259262 F (static_cast <const F&>(f)),
260263 A (static_cast <const A&>(f))
@@ -273,7 +276,7 @@ namespace network_boost {
273276
274277 // Function pointers
275278 static inline void
276- manage_ptr (const function_buffer& in_buffer, function_buffer& out_buffer,
279+ manage_ptr (const function_buffer& in_buffer, function_buffer& out_buffer,
277280 functor_manager_operation_type op)
278281 {
279282 if (op == clone_functor_tag)
@@ -299,11 +302,11 @@ namespace network_boost {
299302
300303 // Function objects that fit in the small-object buffer.
301304 static inline void
302- manage_small (const function_buffer& in_buffer, function_buffer& out_buffer,
305+ manage_small (const function_buffer& in_buffer, function_buffer& out_buffer,
303306 functor_manager_operation_type op)
304307 {
305308 if (op == clone_functor_tag || op == move_functor_tag) {
306- const functor_type* in_functor =
309+ const functor_type* in_functor =
307310 reinterpret_cast <const functor_type*>(&in_buffer.data );
308311 new (reinterpret_cast <void *>(&out_buffer.data )) functor_type (*in_functor);
309312
@@ -318,7 +321,7 @@ namespace network_boost {
318321 (void )f; // suppress warning about the value of f not being used (MSVC)
319322 f->~Functor ();
320323 } else if (op == check_functor_type_tag) {
321- const detail::sp_typeinfo& check_type
324+ const detail::sp_typeinfo& check_type
322325 = *out_buffer.type .type ;
323326 if (BOOST_FUNCTION_COMPARE_TYPE_ID (check_type, BOOST_SP_TYPEID (Functor)))
324327 out_buffer.obj_ptr = &in_buffer.data ;
@@ -327,7 +330,7 @@ namespace network_boost {
327330 } else /* op == get_functor_type_tag */ {
328331 out_buffer.type .type = &BOOST_SP_TYPEID (Functor);
329332 out_buffer.type .const_qualified = false ;
330- out_buffer.type .volatile_qualified = false ;
333+ out_buffer.type .volatile_qualified = false ;
331334 }
332335 }
333336 };
@@ -340,23 +343,23 @@ namespace network_boost {
340343
341344 // Function pointers
342345 static inline void
343- manager (const function_buffer& in_buffer, function_buffer& out_buffer,
346+ manager (const function_buffer& in_buffer, function_buffer& out_buffer,
344347 functor_manager_operation_type op, function_ptr_tag)
345348 {
346349 functor_manager_common<Functor>::manage_ptr (in_buffer,out_buffer,op);
347350 }
348351
349352 // Function objects that fit in the small-object buffer.
350353 static inline void
351- manager (const function_buffer& in_buffer, function_buffer& out_buffer,
354+ manager (const function_buffer& in_buffer, function_buffer& out_buffer,
352355 functor_manager_operation_type op, mpl::true_)
353356 {
354357 functor_manager_common<Functor>::manage_small (in_buffer,out_buffer,op);
355358 }
356-
359+
357360 // Function objects that require heap allocation
358361 static inline void
359- manager (const function_buffer& in_buffer, function_buffer& out_buffer,
362+ manager (const function_buffer& in_buffer, function_buffer& out_buffer,
360363 functor_manager_operation_type op, mpl::false_)
361364 {
362365 if (op == clone_functor_tag) {
@@ -396,7 +399,7 @@ namespace network_boost {
396399 // object can use the small-object optimization buffer or
397400 // whether we need to allocate it on the heap.
398401 static inline void
399- manager (const function_buffer& in_buffer, function_buffer& out_buffer,
402+ manager (const function_buffer& in_buffer, function_buffer& out_buffer,
400403 functor_manager_operation_type op, function_obj_tag)
401404 {
402405 manager (in_buffer, out_buffer, op,
@@ -405,7 +408,7 @@ namespace network_boost {
405408
406409 // For member pointers, we use the small-object optimization buffer.
407410 static inline void
408- manager (const function_buffer& in_buffer, function_buffer& out_buffer,
411+ manager (const function_buffer& in_buffer, function_buffer& out_buffer,
409412 functor_manager_operation_type op, member_ptr_tag)
410413 {
411414 manager (in_buffer, out_buffer, op, mpl::true_ ());
@@ -415,7 +418,7 @@ namespace network_boost {
415418 /* Dispatch to an appropriate manager based on whether we have a
416419 function pointer or a function object pointer. */
417420 static inline void
418- manage (const function_buffer& in_buffer, function_buffer& out_buffer,
421+ manage (const function_buffer& in_buffer, function_buffer& out_buffer,
419422 functor_manager_operation_type op)
420423 {
421424 typedef typename get_function_tag<functor_type>::type tag_type;
@@ -441,23 +444,23 @@ namespace network_boost {
441444
442445 // Function pointers
443446 static inline void
444- manager (const function_buffer& in_buffer, function_buffer& out_buffer,
447+ manager (const function_buffer& in_buffer, function_buffer& out_buffer,
445448 functor_manager_operation_type op, function_ptr_tag)
446449 {
447450 functor_manager_common<Functor>::manage_ptr (in_buffer,out_buffer,op);
448451 }
449452
450453 // Function objects that fit in the small-object buffer.
451454 static inline void
452- manager (const function_buffer& in_buffer, function_buffer& out_buffer,
455+ manager (const function_buffer& in_buffer, function_buffer& out_buffer,
453456 functor_manager_operation_type op, mpl::true_)
454457 {
455458 functor_manager_common<Functor>::manage_small (in_buffer,out_buffer,op);
456459 }
457-
460+
458461 // Function objects that require heap allocation
459462 static inline void
460- manager (const function_buffer& in_buffer, function_buffer& out_buffer,
463+ manager (const function_buffer& in_buffer, function_buffer& out_buffer,
461464 functor_manager_operation_type op, mpl::false_)
462465 {
463466 typedef functor_wrapper<Functor,Allocator> functor_wrapper_type;
@@ -490,7 +493,7 @@ namespace network_boost {
490493 wrapper_allocator.deallocate (victim,1 );
491494 out_buffer.obj_ptr = 0 ;
492495 } else if (op == check_functor_type_tag) {
493- const detail::sp_typeinfo& check_type
496+ const detail::sp_typeinfo& check_type
494497 = *out_buffer.type .type ;
495498 if (BOOST_FUNCTION_COMPARE_TYPE_ID (check_type, BOOST_SP_TYPEID (Functor)))
496499 out_buffer.obj_ptr = in_buffer.obj_ptr ;
@@ -507,7 +510,7 @@ namespace network_boost {
507510 // object can use the small-object optimization buffer or
508511 // whether we need to allocate it on the heap.
509512 static inline void
510- manager (const function_buffer& in_buffer, function_buffer& out_buffer,
513+ manager (const function_buffer& in_buffer, function_buffer& out_buffer,
511514 functor_manager_operation_type op, function_obj_tag)
512515 {
513516 manager (in_buffer, out_buffer, op,
@@ -518,7 +521,7 @@ namespace network_boost {
518521 /* Dispatch to an appropriate manager based on whether we have a
519522 function pointer or a function object pointer. */
520523 static inline void
521- manage (const function_buffer& in_buffer, function_buffer& out_buffer,
524+ manage (const function_buffer& in_buffer, function_buffer& out_buffer,
522525 functor_manager_operation_type op)
523526 {
524527 typedef typename get_function_tag<functor_type>::type tag_type;
@@ -604,8 +607,8 @@ namespace network_boost {
604607 */
605608 struct vtable_base
606609 {
607- void (*manager)(const function_buffer& in_buffer,
608- function_buffer& out_buffer,
610+ void (*manager)(const function_buffer& in_buffer,
611+ function_buffer& out_buffer,
609612 functor_manager_operation_type op);
610613 };
611614 } // end namespace function
@@ -645,7 +648,7 @@ class function_base
645648 type_result.type .type = &BOOST_SP_TYPEID (Functor);
646649 type_result.type .const_qualified = is_const<Functor>::value;
647650 type_result.type .volatile_qualified = is_volatile<Functor>::value;
648- get_vtable ()->manager (functor, type_result,
651+ get_vtable ()->manager (functor, type_result,
649652 detail::function::check_functor_type_tag);
650653 return static_cast <Functor*>(type_result.obj_ptr );
651654 }
@@ -659,7 +662,7 @@ class function_base
659662 type_result.type .type = &BOOST_SP_TYPEID (Functor);
660663 type_result.type .const_qualified = true ;
661664 type_result.type .volatile_qualified = is_volatile<Functor>::value;
662- get_vtable ()->manager (functor, type_result,
665+ get_vtable ()->manager (functor, type_result,
663666 detail::function::check_functor_type_tag);
664667 // GCC 2.95.3 gets the CV qualifiers wrong here, so we
665668 // can't do the static_cast that we should do.
@@ -887,6 +890,6 @@ namespace detail {
887890
888891#if defined(BOOST_MSVC)
889892# pragma warning( pop )
890- #endif
893+ #endif
891894
892895#endif // BOOST_FUNCTION_BASE_HEADER
0 commit comments