Merge
[cython.git] / tests / errors / e_cstruct.pyx
1 cdef struct Spam:
2         int i
3         char c
4         float *p[42]
5         obj             # error - py object
6
7 #cdef struct Spam: # error - redefined (not an error in Cython, should it be?)
8 #       int j
9
10 cdef struct Grail
11
12 cdef void eggs(Spam s):
13         cdef int j
14         cdef Grail *gp
15         j = s.k # error - undef attribute
16         j = s.p # type error
17         s.p = j # type error
18         j = j.i # error - no attributes
19         j.i = j # error - no attributes
20         j = gp.x # error - incomplete type
21         gp.x = j # error - incomplete type
22 _ERRORS = u"""
23 /Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:5:36: C struct/union member cannot be a Python object
24 /Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:15:6: Object of type 'Spam' has no attribute 'k'
25 /Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:16:6: Cannot assign type 'float *[42]' to 'int'
26 /Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:17:21: Cannot assign type 'int' to 'float *[42]'
27 /Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:18:6: Object of type 'int' has no attribute 'i'
28 /Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:19:2: Object of type 'int' has no attribute 'i'
29 /Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:20:7: Cannot select attribute of incomplete type 'Grail'
30 /Local/Projects/D/Pyrex/Source/Tests/Errors2/e_cstruct.pyx:21:3: Cannot select attribute of incomplete type 'Grail'
31 """