jit: handle equality of function pointer types
[official-gcc.git] / gcc / testsuite / jit.dg / test-error-gcc_jit_context_new_field-opaque-struct.c
blobfb4e54d6078dbc938b72ad4e738a15f60fc916e0
1 #include <stdlib.h>
2 #include <stdio.h>
4 #include "libgccjit.h"
6 #include "harness.h"
8 /* Try to put an opaque struct inside another struct
9 (or union); the API ought to complain. */
11 void
12 create_code (gcc_jit_context *ctxt, void *user_data)
14 gcc_jit_struct *t_opaque =
15 gcc_jit_context_new_opaque_struct (ctxt, NULL, "opaque");
17 (void)gcc_jit_context_new_field (ctxt, NULL,
18 gcc_jit_struct_as_type (t_opaque),
19 "f_opaque");
22 void
23 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
25 CHECK_VALUE (result, NULL);
27 /* Verify that the correct error message was emitted. */
28 CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt),
29 "gcc_jit_context_new_field:"
30 " unknown size for field \"f_opaque\" (type: struct opaque)");