mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 21:25:13 +00:00
Only disable placement-new warning under gcc >= 6
Otherwise this would create unknown option warnings under g++ < 6.
This commit is contained in:
parent
cae0e00947
commit
0b12f91fa3
@ -82,12 +82,12 @@ protected:
|
|||||||
|
|
||||||
/* Store the capture object directly in the function record if there is enough space */
|
/* Store the capture object directly in the function record if there is enough space */
|
||||||
if (sizeof(capture) <= sizeof(rec->data)) {
|
if (sizeof(capture) <= sizeof(rec->data)) {
|
||||||
#if defined(__GNUG__) && !defined(__clang__)
|
#if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 6
|
||||||
# pragma GCC diagnostic push
|
# pragma GCC diagnostic push
|
||||||
# pragma GCC diagnostic ignored "-Wplacement-new"
|
# pragma GCC diagnostic ignored "-Wplacement-new"
|
||||||
#endif
|
#endif
|
||||||
new ((capture *) &rec->data) capture { std::forward<Func>(f) };
|
new ((capture *) &rec->data) capture { std::forward<Func>(f) };
|
||||||
#if defined(__GNUG__) && !defined(__clang__)
|
#if defined(__GNUG__) && !defined(__clang__) && __GNUC__ >= 6
|
||||||
# pragma GCC diagnostic pop
|
# pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
if (!std::is_trivially_destructible<Func>::value)
|
if (!std::is_trivially_destructible<Func>::value)
|
||||||
|
Loading…
Reference in New Issue
Block a user