Issue #16 resolved

Anonymous/untagged enum causes error

created an issue

This code only works with the ctypes backend: {{{


from cffi import FFI, backend_ctypes

ffi = FFI(backend=backend_ctypes.CTypesBackend()) # doesn't exhibit bug

ffi = FFI()

ffi.cdef(""" typedef struct { enum /ThisNameRequired/ { Value0 = 0 } e; } Foo; """)

api ='Foo') }}}

Comments (6)

  1. tlynn reporter
    Traceback (most recent call last):
      File "", line 13, in <module>
        api ='Foo')
      File "/home/tlynn/cffi-hg/cffi/", line 172, in new
        return self._backend.newp(cdecl, init)
    TypeError: expected a pointer or array ctype, got 'struct $Foo'

    Same code. Should I be using the default branch in cffi hg?

  2. tlynn reporter

    I'd lost a "*" while editing it down to a minimal test case. The code example should say "typedef struct { ... } *Foo;". cffi bug seems fixed.

  3. Log in to comment