╭ incomplete_struct_param_tld.zig ──────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
.. conflicting_externs/ hasdecl/ import/ namespace_depends_on_compile_var/ pub_enum/ x86_64/ zon/ abs.zig addrspace_and_linksection.zig align.zig alignof.zig array.zig asm.zig atomics.zig backing_int.zig basic.zig bit_shifting.zig bitcast.zig bitreverse.zig bool.zig builtin_functions_returning_void_ byteswap.zig byval_arg_var.zig call.zig cast.zig cast_int.zig comptime_memory.zig const_slice_child.zig decl_literals.zig decltest.zig defer.zig destructure.zig duplicated_test_names.zig enum.zig error.zig eval.zig export_builtin.zig export_c_keywords.zig export_keyword.zig export_self_referential_type_info extern.zig extern_struct_zero_size_fields.zi field_parent_ptr.zig file_to_embed.txt floatop.zig fn.zig fn_delegation.zig fn_in_struct_in_comptime.zig for.zig generics.zig globals.zig hasdecl.zig hasfield.zig if.zig import.zig import_c_keywords.zig ╭─────────────────────────────────╮ │incomplete_struct_param_tld.zig │ ╰─────────────────────────────────╯ inline_switch.zig int128.zig int_comparison_elision.zig ir_block_deps.zig lower_strlit_to_vector.zig math.zig maximum_minimum.zig member_func.zig memcpy.zig memmove.zig memset.zig merge_error_sets.zig muladd.zig multiple_externs_with_conflicting namespace_depends_on_compile_var. nan.zig null.zig optional.zig overlapping_assign.zig packed-struct.zig packed-union.zig packed_struct_explicit_backing_in pointers.zig popcount.zig prefetch.zig ptrcast.zig ptrfromint.zig pub_enum.zig ref_var_in_if_after_if_2nd_switch reflection.zig return_address.zig saturating_arithmetic.zig select.zig shuffle.zig sizeof_and_typeof.zig slice.zig slice_sentinel_comptime.zig spirv.zig splat.zig src.zig string_literals.zig struct.zig struct_contains_null_ptr_itself.z struct_contains_slice_of_itself.z switch.zig switch_loop.zig switch_on_captured_error.zig switch_prong_err_enum.zig switch_prong_implicit_cast.zig this.zig threadlocal.zig truncate.zig try.zig tuple.zig tuple_declarations.zig type.zig type_info.zig typename.zig undefined.zig underscore.zig union.zig var_args.zig vector.zig void.zig wasm.zig while.zig widening.zig wrapping_arithmetic.zig x86_64.zig zero.bin zon.zig
1 const builtin = @import("builtin"); 2 const expect = @import("std").testing.expect; 3 4 const A = struct { 5 b: B, 6 }; 7 8 const B = struct { 9 c: C, 10 }; 11 12 const C = struct { 13 x: i32, 14 15 fn d(c: *const C) i32 { 16 return c.x; 17 } 18 }; 19 20 fn foo(a: A) i32 { 21 return a.b.c.d(); 22 } 23 24 test "incomplete struct param top level declaration" { 25 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO 26 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; 27 28 const a = A{ 29 .b = B{ 30 .c = C{ .x = 13 }, 31 }, 32 }; 33 try expect(foo(a) == 13); 34 } 35