pybind / pybind11

Seamless operability between C++11 and Python

Home Page:https://pybind11.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]: error: static assertion failed: char should be cast to either signed char or unsigned char

mtelka opened this issue · comments

Required prerequisites

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