Skip to content

Commit 88cec11

Browse files
committed
Suppress gcc 4.8.5 (CentOS 7) warning.
``` include/pybind11/eigen/../numpy.h:63:53: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] return *reinterpret_cast<T *>(value_storage_); ^ ```
1 parent 109a165 commit 88cec11

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/pybind11/numpy.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ class LazyInitializeAtLeastOnceDestroyNever {
5959
initialized_ = true;
6060
}
6161
}
62+
PYBIND11_WARNING_PUSH
63+
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 5
64+
// Needed for gcc 4.8.5
65+
PYBIND11_WARNING_DISABLE_CLANG("-Wstrict-aliasing")
66+
#endif
6267
return *reinterpret_cast<T *>(value_storage_);
68+
PYBIND11_WARNING_POP
6369
}
6470

6571
private:

0 commit comments

Comments
 (0)