Skip to content

Commit

Permalink
Suppress gcc 4.8.5 (CentOS 7) warning.
Browse files Browse the repository at this point in the history
```
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_);
                                                     ^
```
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Oct 9, 2023
1 parent 109a165 commit 88cec11
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/pybind11/numpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ class LazyInitializeAtLeastOnceDestroyNever {
initialized_ = true;
}
}
PYBIND11_WARNING_PUSH
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 5
// Needed for gcc 4.8.5
PYBIND11_WARNING_DISABLE_CLANG("-Wstrict-aliasing")
#endif
return *reinterpret_cast<T *>(value_storage_);
PYBIND11_WARNING_POP
}

private:
Expand Down

0 comments on commit 88cec11

Please sign in to comment.