diff --git a/source/class.cpp b/source/class.cpp index 048bdc10..984ed88c 100644 --- a/source/class.cpp +++ b/source/class.cpp @@ -1086,7 +1086,7 @@ std::string ClassBinder::bind_repr(Context &context, Config const &config) if( FunctionDecl const *F = context.global_insertion_operator(C) ) { // outs() << "Found insertion operator for: " << class_qualified_name(C) << "\n"; - c += "\n\tcl.def(\"__str__\", []({} const &o) -> std::string {{ std::ostringstream s; {}(s, o); return s.str(); }} );\n"_format(qualified_name, F->getQualifiedNameAsString()); + c += "\n\tcl.def(\"__str__\", []({} const &o) -> std::string {{ std::ostringstream s; s << o; return s.str(); }} );\n"_format(qualified_name); prefix_includes_.push_back(F); } diff --git a/test/T12.operator.ref b/test/T12.operator.ref index 0bba291c..a9e23331 100644 --- a/test/T12.operator.ref +++ b/test/T12.operator.ref @@ -25,7 +25,7 @@ void bind_T12_operator(std::function< pybind11::module &(std::string const &name cl.def("__add__", (struct T & (T::*)(int)) &T::operator+, "C++: T::operator+(int) --> struct T &", pybind11::return_value_policy::automatic, pybind11::arg("")); cl.def("__sub__", (struct T & (T::*)(int)) &T::operator-, "C++: T::operator-(int) --> struct T &", pybind11::return_value_policy::automatic, pybind11::arg("")); cl.def("__mul__", (struct T & (T::*)(int)) &T::operator*, "C++: T::operator*(int) --> struct T &", pybind11::return_value_policy::automatic, pybind11::arg("")); - cl.def("__truediv__", (struct T & (T::*)(int)) &T::operator/, "C++: T::operator/(int) --> struct T &", pybind11::return_value_policy::automatic, pybind11::arg("")); + cl.def("__div__", (struct T & (T::*)(int)) &T::operator/, "C++: T::operator/(int) --> struct T &", pybind11::return_value_policy::automatic, pybind11::arg("")); cl.def("__mod__", (struct T & (T::*)(int)) &T::operator%, "C++: T::operator%(int) --> struct T &", pybind11::return_value_policy::automatic, pybind11::arg("")); cl.def("__or__", (struct T & (T::*)(int)) &T::operator|, "C++: T::operator|(int) --> struct T &", pybind11::return_value_policy::automatic, pybind11::arg("")); cl.def("__and__", (struct T & (T::*)(int)) &T::operator&, "C++: T::operator&(int) --> struct T &", pybind11::return_value_policy::automatic, pybind11::arg("")); @@ -35,7 +35,7 @@ void bind_T12_operator(std::function< pybind11::module &(std::string const &name cl.def("__iadd__", (void (T::*)(int)) &T::operator+=, "C++: T::operator+=(int) --> void", pybind11::arg("")); cl.def("__isub__", (void (T::*)(int)) &T::operator-=, "C++: T::operator-=(int) --> void", pybind11::arg("")); cl.def("__imul__", (void (T::*)(int)) &T::operator*=, "C++: T::operator*=(int) --> void", pybind11::arg("")); - cl.def("__itruediv__", (void (T::*)(int)) &T::operator/=, "C++: T::operator/=(int) --> void", pybind11::arg("")); + cl.def("__idiv__", (void (T::*)(int)) &T::operator/=, "C++: T::operator/=(int) --> void", pybind11::arg("")); cl.def("__imod__", (void (T::*)(int)) &T::operator%=, "C++: T::operator%=(int) --> void", pybind11::arg("")); cl.def("__ior__", (void (T::*)(int)) &T::operator|=, "C++: T::operator|=(int) --> void", pybind11::arg("")); cl.def("__iand__", (void (T::*)(int)) &T::operator&=, "C++: T::operator&=(int) --> void", pybind11::arg("")); diff --git a/test/T31.include_for_class.hpp b/test/T31.include_for_class.hpp index f3c13a9c..a1dd6b70 100644 --- a/test/T31.include_for_class.hpp +++ b/test/T31.include_for_class.hpp @@ -10,4 +10,3 @@ #include #include -#include diff --git a/test/T31.include_for_class.incl.c.include b/test/T31.include_for_class.incl.c.include deleted file mode 100644 index 5e3857da..00000000 --- a/test/T31.include_for_class.incl.c.include +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include -#include - -namespace aaaa -{ - -namespace cccc { -std::ostream & operator<<(std::ostream & s, const A & a) { return s; } -} - -} diff --git a/test/T31.include_for_class.ref b/test/T31.include_for_class.ref index 4d3be880..239c2f38 100644 --- a/test/T31.include_for_class.ref +++ b/test/T31.include_for_class.ref @@ -1,12 +1,6 @@ // File: T31_include_for_class_incl_a_include.cpp #include // aaaa::A -#include // aaaa::cccc::operator<< -#include // std::_Ios_Seekdir -#include // std::locale -#include // std::basic_ostream #include // __str__ -#include // std::basic_streambuf -#include // std::char_traits #include #include @@ -24,8 +18,6 @@ void bind_T31_include_for_class_incl_a_include(std::function< pybind11::module & { // aaaa::A file:T31.include_for_class.incl.a.include line:6 pybind11::class_> cl(M("aaaa"), "A", ""); cl.def( pybind11::init( [](){ return new aaaa::A(); } ) ); - - cl.def("__str__", [](aaaa::A const &o) -> std::string { std::ostringstream s; aaaa::cccc::operator<<(s, o); return s.str(); } ); } }