jit: handle equality of function pointer types
[official-gcc.git] / gcc / testsuite / jit.dg / test-error-gcc_jit_function_new_local-opaque-struct.c
blob41fbee2026edf8e80625d640656d91a2fb449655
1 #include <stdlib.h>
2 #include <stdio.h>
4 #include "libgccjit.h"
6 #include "harness.h"
8 /* Try to create a local of an opaque struct;
9 the API ought to complain. */
11 void
12 create_code (gcc_jit_context *ctxt, void *user_data)
14 gcc_jit_type *t_void =
15 gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID);
17 gcc_jit_struct *t_opaque =
18 gcc_jit_context_new_opaque_struct (ctxt, NULL, "opaque");
20 gcc_jit_function *func =
21 gcc_jit_context_new_function (ctxt, NULL,
22 GCC_JIT_FUNCTION_EXPORTED,
23 t_void,
24 "test_fn",
25 0, NULL,
26 0);
28 (void)gcc_jit_function_new_local (func, NULL,
29 gcc_jit_struct_as_type (t_opaque),
30 "i");
33 void
34 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
36 CHECK_VALUE (result, NULL);
38 /* Verify that the correct error message was emitted. */
39 CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt),
40 "gcc_jit_function_new_local:"
41 " unknown size for local \"i\" (type: struct opaque)");