binder
binder copied to clipboard
Literal operator bound oddly
When binding user-defined literal operators, binder seems to give undesired result. Consider:
namespace Test {
struct A { int a; };
inline A operator"" _a(const char * const c, unsigned long a) { return {0}; }
}
The relevant bit of output is:
M("Test").def("operator""_a", (struct Test::A (*)(const char *const, unsigned long)) &Test::operator""_a, "C++: Test::operator""_a(const char *const, unsigned long) --> struct Test::A", pybind11::arg("c"), pybind11::arg("a"));
Note that "operator""_a" is a valid string that ends up as "operator_a"; though I suspect this is a bug that happens to fail less loudly than it could have.
I'm not sure if this should be marked as a bug or not. I imagine it is, but it is one that happens to not break things but rather bind oddly because of C++ syntax rules.
Thank you for letting me know @zwimer ! This is definitely fixable, i am adding this to my list.