enum class ConsoleForegroundColor {
Green = 32,
Yellow = 33,
Blue = -1, // -1 instead of 34
Magenta = 35
};
You should see an error similar to the following. (Note I tested this with a much simpler example thus the difference in pathing from the original)
$ pybind11-stubgen.exe pybind11_example --enum-class-locations="ConsoleForegroundColor:pybind11_example"
pybind11_stubgen - [ ERROR] In pybind11_example : Invalid expression '<ConsoleForegroundColor.Blue: -1>'
pybind11_stubgen - [WARNING] Raw C++ types/values were found in signatures extracted from docstrings.
Please check the corresponding sections of pybind11 documentation to avoid common mistakes in binding code:
- https://pybind11.readthedocs.io/en/latest/advanced/misc.html#avoiding-cpp-types-in-docstrings
- https://pybind11.readthedocs.io/en/latest/advanced/functions.html#default-arguments-revisited
Hello there is a small issue with the latest version and parsing default argument enums when the backing enum value is -1.
If you modify your test demo example here: https://github.com/sizmailov/pybind11-stubgen/blob/master/tests/demo-lib/include/demo/sublibA/ConsoleColors.h#L5
To the following:
You should see an error similar to the following. (Note I tested this with a much simpler example thus the difference in pathing from the original)
This is occurring on the following binding in your test. https://github.com/sizmailov/pybind11-stubgen/blob/master/tests/py-demo/bindings/src/modules/enum.cpp