[BUG]: error: static assertion failed: char should be cast to either signed char or unsigned char
mtelka opened this issue · comments
Marcel Telka commented
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
2.11.1
Problem description
I'm trying to compile pybind11 tests and compilatoin fails here:
pybind11-2.11.1/tests/test_enum.cpp:95:16: error: static assertion failed: char should be cast to either signed char or unsigned char
92 | py::detail::any_of<
| ~~~~~~~~~~~~~~~~~~~
93 | std::is_same<py::enum_<ScopedCharEnum>::Scalar, signed char>, // e.g. gcc on x86
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94 | std::is_same<py::enum_<ScopedCharEnum>::Scalar, unsigned char> // e.g. arm linux
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95 | >::value,
| ~~~^~~~~
I think the assertion is wrong since char
, unsigned char
and signed char
are three distinct types.
Reference:
https://en.cppreference.com/w/cpp/language/types
https://stackoverflow.com/questions/2054939/is-char-signed-or-unsigned-by-default
Reproducible example code
No response
Is this a regression? Put the last known working version here if it is.
Not a regression