Commit 2fee9617 authored by Robert Bradshaw's avatar Robert Bradshaw

Use reference rather than pointer for destructor calling.

This avoids the issue with overloaded address-of operators.
parent febf956a
...@@ -1345,7 +1345,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1345,7 +1345,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("if (p->__weakref__) PyObject_ClearWeakRefs(o);") code.putln("if (p->__weakref__) PyObject_ClearWeakRefs(o);")
for entry in cpp_class_attrs: for entry in cpp_class_attrs:
code.putln("__Pyx_call_destructor(&p->%s);" % entry.cname) code.putln("__Pyx_call_destructor(p->%s);" % entry.cname)
for entry in py_attrs: for entry in py_attrs:
code.put_xdecref_clear("p->%s" % entry.cname, entry.type, nanny=False, code.put_xdecref_clear("p->%s" % entry.cname, entry.type, nanny=False,
......
...@@ -248,8 +248,8 @@ typedef struct { ...@@ -248,8 +248,8 @@ typedef struct {
// Work around clang bug http://stackoverflow.com/questions/21847816/c-invoke-nested-template-class-destructor // Work around clang bug http://stackoverflow.com/questions/21847816/c-invoke-nested-template-class-destructor
template<typename T> template<typename T>
void __Pyx_call_destructor(T* x) { void __Pyx_call_destructor(T& x) {
x->~T(); x.~T();
} }
// Used for temporary variables of "reference" type. // Used for temporary variables of "reference" type.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment