Last active
December 11, 2015 06:59
-
-
Save uweschmitt/4563294 to your computer and use it in GitHub Desktop.
The following code demonstrates a problem discussed on https://groups.google.com/forum/?fromgroups#!forum/cython-users If one runs "cython --cplus ...." on this file the last function produces an error message.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdef extern from "*": | |
3 | |
4 cdef cppclass A: | |
5 A() | |
6 int fun(int) | |
7 float fun(float) | |
8 | |
9 cdef cppclass B(A): | |
10 B() | |
11 | |
12 cdef cppclass C[X]: | |
13 int fun(int) | |
14 float fun(float) | |
15 | |
16 cdef cppclass D(C[int]): | |
17 D() | |
18 | |
19 | |
20 # B inherits from class WITHOUT template parameters | |
21 cdef B b | |
22 print b.fun(1) | |
23 print b.fun(1.0) | |
24 | |
25 | |
26 # D inherits from class WITH template parameters | |
27 cdef D d | |
28 print d.fun(1) | |
29 # complains: "connot assign double to int" | |
30 print d.fun(1.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment