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.
11 #include "libgccjit.h"
15 create_code (gcc_jit_context
*ctxt
, void *user_data
)
17 gcc_jit_type
*int_type
= gcc_jit_context_get_type (ctxt
,
19 gcc_jit_type
*float_type
= gcc_jit_context_get_type (ctxt
,
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
,
29 gcc_jit_rvalue
*ctor
= gcc_jit_context_new_array_constructor
35 CHECK_VALUE (ctor
, NULL
);
39 verify_code (gcc_jit_context
*ctxt
, gcc_jit_result
*result
)
41 /* Ensure that the bad API usage prevents the API giving a bogus
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)");