@@ -409,7 +409,6 @@ class cpp_function : public function {
409409 }
410410 }
411411 }
412-
413412 if (kwargs_consumed == nkwargs)
414413 result = it->impl (it, args_, parent);
415414
@@ -937,10 +936,11 @@ template <typename Type> class enum_ : public class_<Type> {
937936 ((it == entries->end ()) ? std::string (" ???" )
938937 : std::string (it->second ));
939938 });
940- this ->def (" __init__" , [](Type& value, int i) { value = (Type) i; });
939+ this ->def (" __init__" , [](Type& value, int i) { value = (Type)i; });
940+ this ->def (" __init__" , [](Type& value, int i) { new (&value) Type ((Type) i); });
941941 this ->def (" __int__" , [](Type value) { return (int ) value; });
942- this ->def (" __eq__" , [](const Type &value, Type value2) { return value == value2; });
943- this ->def (" __ne__" , [](const Type &value, Type value2) { return value != value2; });
942+ this ->def (" __eq__" , [](const Type &value, Type * value2) { return value2 && value == * value2; });
943+ this ->def (" __ne__" , [](const Type &value, Type * value2) { return !value2 || value != * value2; });
944944 this ->def (" __hash__" , [](const Type &value) { return (int ) value; });
945945 m_entries = entries;
946946 }
0 commit comments