Ticket #523 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

Compiler crash in C++ declarations

Reported by: robertwb Owned by: robertwb
Priority: major Milestone: 0.15
Component: C++ Keywords:
Cc:

Description

 http://groups.google.com/group/cython-users/browse_thread/thread/34dd7cecbffcfd44

...
 File "/home/matt/Downloads/cython-devel-d9a3831ec027/cython-devel-
d9a3831ec027/Cython/Compiler/Nodes.py", line 1050, in
analyse_declarations
   attr.analyse_declarations(scope)
 File "/home/matt/Downloads/cython-devel-d9a3831ec027/cython-devel-
d9a3831ec027/Cython/Compiler/Nodes.py", line 939, in
analyse_declarations
   api = self.api)
 File "/home/matt/Downloads/cython-devel-d9a3831ec027/cython-devel-
d9a3831ec027/Cython/Compiler/Symtab.py", line 1564, in
declare_cfunction
   self.check_base_default_constructor(pos)
 File "/home/matt/Downloads/cython-devel-d9a3831ec027/cython-devel-
d9a3831ec027/Cython/Compiler/Symtab.py", line 1537, in
check_base_default_constructor
   if len(entry.type.base_classes) == 0:
AttributeError: 'CStructOrUnionType' object has no attribute
'base_classes'

Attachments

badmat.h Download (285 bytes) - added by MattBro 3 years ago.
simple .pyx and .h files to replicate bug
badmat.pyx Download (0.5 KB) - added by MattBro 3 years ago.

Change History

Changed 3 years ago by robertwb

  • milestone changed from wishlist to 0.13

Changed 3 years ago by MattBro

simple .pyx and .h files to replicate bug

Changed 3 years ago by MattBro

Changed 3 years ago by MattBro

So the issue appears to be that my attempt to forward declare gpumat (ahh that should have been replaced with badmat in my example), results in an error when declaring the gpumat constructor. Thus currently forward declarations are precluded.

However this will create problems for sufficiently complex C++ code. In my case I have a subclass of gpumat (cupper) that I need to forward declare in my C++ code. That's because a method in the gpumat class (qr() ) returns a cupper. How can this be done in the current C++ wrapper code?

Changed 3 years ago by robertwb

  • milestone changed from 0.13 to 0.13.1

Changed 2 years ago by robertwb

  • milestone changed from 0.14 to 0.14.1

Changed 2 years ago by robertwb

  • owner changed from somebody to robertwb

A smaller testcase:

cdef extern from *:
    ctypedef struct gpumat
    cdef cppclass gpumat: 
        gpumat() 

Changed 2 years ago by robertwb

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.