Hi,

sorry for spreading these issues into three mails, but I cannot quite figure out whether they are related or not. So, here is the third installment of my adventures with nested classes.

Consider the following code which compiles fine:

---8<---
cdef extern from "foo":
   cdef cppclass outer[T]:
      outer( )
      cppclass inner:
         pass

cdef outer[int].inner bar
---8<---

If I change 'outer' to lose its default constructor, the last line, which instantiates 'inner', causes an error:

---8<---
cdef extern from "foo":
   cdef cppclass outer[T]:
      outer( int )
      cppclass inner:
         pass

cdef outer[int].inner bar
---8<---

The only change is that the constructor to 'outer' now takes an argument. Now, the last line causes this error:
   "C++ class must have a default constructor to be stack allocated".

However, 'inner' does have a default constructor, only 'outer' does not.

Could it be that Cython looks for the constructor for the outer class where it should look for the constructor for the inner class?

Cheers
  Simon
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to