Commit fd9a055d authored by gsamain's avatar gsamain

Clean cppclass <init> management

parent 3db844e9
......@@ -3882,7 +3882,10 @@ class CppClassType(CType):
break
func_type = CFuncType(self, [], exception_check='+', nogil=nogil)
return self.scope.declare_cfunction(u'<init>', func_type, pos)
entry = self.scope.declare_cfunction(u'<init>', func_type, pos)
# This flag is set in order to be able to override this default __init__ by a user-defined one
entry.is_inherited = 1
return entry
def check_nullary_constructor(self, pos, msg="stack allocated"):
constructor = self.scope.lookup(u'<init>')
......
......@@ -456,11 +456,7 @@ class Scope(object):
if type.is_cfunction and old_entry.type.is_cfunction and self.is_cpp_class_scope:
for index, alt_entry in enumerate(old_entry.all_alternatives()):
if type.compatible_signature_with(alt_entry.type):
if name == '<init>' and not type.args:
# Cython pre-declares the no-args constructor - allow later user definitions.
old_index = index
cpp_override_allowed = True
elif alt_entry.is_inherited:
if alt_entry.is_inherited:
old_index = index
cpp_override_allowed = True
break
......
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