cd02e6c8adb1d64d21ae426690540cad7aedc2cb
[cython.git] / tests / errors / e_callspec.pyx
1 # mode: error
2
3 cimport cython
4
5 @cython.callspec("")
6 cdef void h1(): pass
7
8 @cython.callspec("__cdecl")
9 cdef void __cdecl h2(): pass
10
11 @cython.callspec("__stdcall")
12 cdef void __stdcall h3(): pass
13
14 @cython.callspec("__fastcall")
15 cdef void __fastcall h4(): pass
16
17 @cython.callspec("__cdecl")
18 cdef void __stdcall h5(): pass # fail
19
20 @cython.callspec("__cdecl")
21 cdef void __fastcall h6(): pass # fail
22
23 cdef void (*p1)()
24 cdef void (__cdecl *p2)()
25 cdef void (__stdcall *p3)()
26 cdef void (__fastcall *p4)()
27
28 p1 = h1
29 p2 = h2
30 p3 = h3
31 p4 = h4
32
33 #p1 = h2 # fail
34 #p1 = h3 # fail
35 #p1 = h4 # fail
36
37 #p2 = h1 # fail
38 #p2 = h3 # fail
39 #p2 = h4 # fail
40
41 _ERRORS = u"""
42 18:22: cannot have both '__stdcall' and '__cdecl' calling conventions
43 21:23: cannot have both '__fastcall' and '__cdecl' calling conventions
44 """
45 #31:14: Cannot assign type 'void (__cdecl )(void)' to 'void (*)(void)'
46 #32:14: Cannot assign type 'void (__stdcall )(void)' to 'void (*)(void)'
47 #33:14: Cannot assign type 'void (__fastcall )(void)' to 'void (*)(void)'
48 #35:14: Cannot assign type 'void (void)' to 'void (__cdecl *)(void)'
49 #36:14: Cannot assign type 'void (__stdcall )(void)' to 'void (__cdecl *)(void)'
50 #37:14: Cannot assign type 'void (__fastcall )(void)' to 'void (__cdecl *)(void)'