libgomp: Document 'GOMP_teams4'
[official-gcc.git] / gcc / testsuite / jit.dg / test-error-ctor-array-wrong-obj.c
blob6b54b8546fc4da400da9289320e7e0a628023c7e
1 /*
3 Test that the proper error is triggered when we build a ctor
4 for an array type, but has the type wrong on an element.
6 */
8 #include <stdlib.h>
9 #include <stdio.h>
11 #include "libgccjit.h"
12 #include "harness.h"
14 void
15 create_code (gcc_jit_context *ctxt, void *user_data)
17 gcc_jit_type *int_type = gcc_jit_context_get_type (ctxt,
18 GCC_JIT_TYPE_INT);
19 gcc_jit_type *float_type = gcc_jit_context_get_type (ctxt,
20 GCC_JIT_TYPE_FLOAT);
22 gcc_jit_type *arr_type =
23 gcc_jit_context_new_array_type (ctxt, 0, int_type, 10);
25 gcc_jit_rvalue *frv = gcc_jit_context_new_rvalue_from_double (ctxt,
26 float_type,
27 12);
29 gcc_jit_rvalue *ctor = gcc_jit_context_new_array_constructor
30 (ctxt, 0,
31 arr_type,
33 &frv);
35 CHECK_VALUE (ctor, NULL);
38 void
39 verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
41 /* Ensure that the bad API usage prevents the API giving a bogus
42 result back. */
43 CHECK_VALUE (result, NULL);
45 /* Verify that the correct error message was emitted. */
46 CHECK_STRING_VALUE (gcc_jit_context_get_first_error (ctxt),
47 "gcc_jit_context_new_array_constructor: array element "
48 "value types differ from types in 'values' (element "
49 "type: int)('values' type: float)");
50 CHECK_STRING_VALUE (gcc_jit_context_get_last_error (ctxt),
51 "gcc_jit_context_new_array_constructor: array element "
52 "value types differ from types in 'values' (element "
53 "type: int)('values' type: float)");