Corrupted constant of opaque type "struct{...;}"
Created originally on Bitbucket by dalcinl (Lisandro Dalcin)
Sorry, not patches this time, I cannot figure out where is the problem.
#!python
from cffi import FFI
ffi = FFI()
ffi.set_source('example1',"""
typedef int opaque_t;
#define CONSTANT ((opaque_t)42)
static int toint(opaque_t o) { return o; }
""")
ffi.cdef("""
typedef struct{...;} opaque_t;
const opaque_t CONSTANT;
int toint(opaque_t);
""")
ffi.compile()
from example1 import ffi,lib
print(lib.toint(lib.CONSTANT)) # should print 42
print(lib.toint(lib.CONSTANT)) # should print 42
#!shell
$ python -c "import cffi; print(cffi.__version__)"
1.0.3
$ python example1_run.py
42
1482790048