| 1 | Backport upstream commit fe4be538e389d5caf6c0a562cd02e58fda9361cb.
|
| 2 |
|
| 3 | Add an explicit upcast in the OO-style test.
|
| 4 |
|
| 5 | https://github.com/yallop/ocaml-ctypes/commit/fe4be538e389d5caf6c0a562cd02e58fda9361cb
|
| 6 |
|
| 7 | It allows to deal with GCC@14 stricter than the previous versions.
|
| 8 |
|
| 9 | diff --git a/tests/clib/test_functions.c b/tests/clib/test_functions.c
|
| 10 | index d19db2b..486b7d1 100644
|
| 11 | |
| 12 | |
| 13 | @@ -293,6 +293,11 @@ struct chorse *new_chorse(int colour)
|
| 14 | h->colour = (enum colour)colour;
|
| 15 | return h;
|
| 16 | }
|
| 17 | +
|
| 18 | +struct animal *new_chorse_as_animal(int colour)
|
| 19 | +{
|
| 20 | + return (struct animal *)new_chorse(colour);
|
| 21 | +}
|
| 22 | /* (End of OO-style example) */
|
| 23 |
|
| 24 | int accept_pointers(float *float_p,
|
| 25 | diff --git a/tests/clib/test_functions.h b/tests/clib/test_functions.h
|
| 26 | index 5022e98..579f622 100644
|
| 27 | |
| 28 | |
| 29 | @@ -79,6 +79,8 @@ extern char *chorse_colour(struct chorse *);
|
| 30 | extern char *chorse_say(struct animal *);
|
| 31 | extern char *chorse_identify(struct animal *);
|
| 32 | extern struct chorse *new_chorse(int);
|
| 33 | +extern struct animal *new_chorse_as_animal(int);
|
| 34 | +
|
| 35 | extern int accept_pointers(float *,
|
| 36 | double *,
|
| 37 | short *,
|
| 38 | diff --git a/tests/test-oo_style/stubs/functions.ml b/tests/test-oo_style/stubs/functions.ml
|
| 39 | index 4434331..6a8e7bd 100644
|
| 40 | |
| 41 | |
| 42 | @@ -82,6 +82,6 @@ struct
|
| 43 | let check_name = foreign "check_name"
|
| 44 | (ptr animal @-> string @-> returning int)
|
| 45 |
|
| 46 | - let new_chorse = foreign "new_chorse"
|
| 47 | + let new_chorse = foreign "new_chorse_as_animal"
|
| 48 | (int @-> returning (ptr animal))
|
| 49 | end
|