// #target: macos-x64
// #debuginfo: yes
module test;
struct Flags { bool flag1; }

fn void foo() {
  int[1] values;
  $foreach $i, $member : Flags.membersof:
    values[$i] = $i;
  $endforeach
}

fn void main() {
  foo();
}

/* #expect: test.ll

define void @test.foo() #0 !dbg !8 {
entry:
  %values = alloca [1 x i32], align 4
  store i32 0, ptr %values, align 4, !dbg !17
  store i32 0, ptr %values, align 4, !dbg !18
  ret void, !dbg !18
}
!0 = !{i32 2, !"Dwarf Version", i32 4}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = !{i32 2, !"wchar_size", i32 4}
!3 = !{i32 4, !"PIC Level", i32 2}
!4 = !{i32 1, !"uwtable", i32 2}
!5 = !{i32 2, !"frame-pointer", i32 2}
!6 = distinct !DICompileUnit
!7 = !DIFile(filename:
!8 = distinct !DISubprogram(name: "foo", linkageName: "test.foo", scope: !7, file: !7, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !11)
!9 = !DISubroutineType(types: !10)
!10 = !{null}
!11 = !{}
!12 = !DILocalVariable(name: "values", scope: !8
!13 = !DICompositeType(tag: DW_TAG_array_type, baseType: !14, size: 32, align: 32, elements: !15)
!14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!15 = !{!16}
!16 = !DISubrange(count: 1, lowerBound: 0)
!17 = !DILocation(line: 5, column: 10, scope: !8)
!18 = !DILocation(line: 7, column: 12, scope: !8)
!19 = distinct !DISubprogram(name: "main", linkageName: "test.main", scope: !7, file: !7, line: 11, type: !9, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6)
!20 = !DILocation(line: 12, column: 3, scope: !19)
!21 = distinct !DISubprogram(name: "_$main", linkageName: "main", scope: !7, file: !7, line: 11, type: !22, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !11)
!22 = !DISubroutineType(types: !23)
!23 = !{!14, !14, !24}
!24 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !25, size: 64, align: 64, dwarfAddressSpace: 0)
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !26, size: 64, align: 64, dwarfAddressSpace: 0)
!26 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_unsigned_char)
!27 = !DILocalVariable(name: ".anon", arg: 1, scope: !21, file: !7, line: 11, type: !14)
!28 = !DILocation(line: 11, column: 9, scope: !21)
!29 = !DILocalVariable(name: ".anon", arg: 2, scope: !21, file: !7, line: 11, type: !24)
