for (int dim = 1; dim <= array_type.rank; dim++) {
CCodeExpression? array_length_expr = null;
if (get_ccode_array_length_type (param) != null) {
- array_length_expr = new CCodeCastExpression (get_array_length_cexpression (arg, dim), get_ccode_array_length_type (param));
+ string length_ctype = get_ccode_array_length_type (param);
+ if (unary.operator == UnaryOperator.REF) {
+ length_ctype = "%s*".printf (length_ctype);
+ }
+ array_length_expr = new CCodeCastExpression (get_array_length_cexpression (arg, dim), length_ctype);
} else {
array_length_expr = get_array_length_cexpression (arg, dim);
}
--- /dev/null
+void foo ([CCode (array_length_type = "gsize")] ref uint8[] a) {
+ assert (a.length == 32);
+}
+
+void main () {
+ uint8[] a = new uint8[32];
+ foo (ref a);
+}