| ... | ... | @@ -1282,10 +1282,10 @@ fn arrayInitExpr( |
| 1282 | 1282 | } |
| 1283 | 1283 | }, |
| 1284 | 1284 | .ptr, .inferred_ptr => |ptr_inst| { |
| 1285 | | return arrayInitExprRlPtr(gz, scope, node, array_init.ast.elements, ptr_inst); |
| 1285 | return arrayInitExprRlPtr(gz, scope, rl, node, ptr_inst, array_init.ast.elements, types.array); |
| 1286 | 1286 | }, |
| 1287 | 1287 | .block_ptr => |block_gz| { |
| 1288 | | return arrayInitExprRlPtr(gz, scope, node, array_init.ast.elements, block_gz.rl_ptr); |
| 1288 | return arrayInitExprRlPtr(gz, scope, rl, node, block_gz.rl_ptr, array_init.ast.elements, types.array); |
| 1289 | 1289 | }, |
| 1290 | 1290 | } |
| 1291 | 1291 | } |
| ... | ... | @@ -1341,9 +1341,29 @@ fn arrayInitExprRlTy( |
| 1341 | 1341 | fn arrayInitExprRlPtr( |
| 1342 | 1342 | gz: *GenZir, |
| 1343 | 1343 | scope: *Scope, |
| 1344 | rl: ResultLoc, |
| 1344 | 1345 | node: Ast.Node.Index, |
| 1346 | result_ptr: Zir.Inst.Ref, |
| 1345 | 1347 | elements: []const Ast.Node.Index, |
| 1348 | array_ty: Zir.Inst.Ref, |
| 1349 | ) InnerError!Zir.Inst.Ref { |
| 1350 | if (array_ty == .none) { |
| 1351 | return arrayInitExprRlPtrInner(gz, scope, node, result_ptr, elements); |
| 1352 | } |
| 1353 | |
| 1354 | var as_scope = try gz.makeCoercionScope(scope, array_ty, result_ptr); |
| 1355 | defer as_scope.instructions.deinit(gz.astgen.gpa); |
| 1356 | |
| 1357 | const result = try arrayInitExprRlPtrInner(&as_scope, scope, node, as_scope.rl_ptr, elements); |
| 1358 | return as_scope.finishCoercion(gz, rl, node, result, array_ty); |
| 1359 | } |
| 1360 | |
| 1361 | fn arrayInitExprRlPtrInner( |
| 1362 | gz: *GenZir, |
| 1363 | scope: *Scope, |
| 1364 | node: Ast.Node.Index, |
| 1346 | 1365 | result_ptr: Zir.Inst.Ref, |
| 1366 | elements: []const Ast.Node.Index, |
| 1347 | 1367 | ) InnerError!Zir.Inst.Ref { |
| 1348 | 1368 | const astgen = gz.astgen; |
| 1349 | 1369 | const gpa = astgen.gpa; |