Created attachment 46079 [details] possible fix in gcc 5.4.0 template<typename _Tp> struct __is_location_invariant : is_trivially_copyable<_Tp>::type { }; __is_location_invariant is evaluated to be true for the closure type (lambda expression) in gcc 4.9.2 template<typename _Tp> struct __is_location_invariant : integral_constant<bool, (is_pointer<_Tp>::value || is_member_pointer<_Tp>::value)> { }; which is evaluated to be false. This may break ABI compatibility when pass function object between libs compiled by 4.9.2 / 5.4.0 gcc. The attachment is a possible fix.
(In reply to Kan Liu from comment #0) > This may break ABI compatibility when pass function object between libs > compiled by 4.9.2 / 5.4.0 gcc. That's not supported, because the C++11 ABI didn't stabilise until GCC 5.1.0, see https://stackoverflow.com/questions/46746878/is-it-safe-to-link-c17-c14-and-c11-objects/49119902#49119902 for a longer explanation. The attached patch doesn't solve the problem, it just moves it. Now you'd have ABI incompatibility between GCC 5.x and GCC 5.x, which is even worse.