| ... | ... | @@ -647,7 +647,10 @@ pub fn len(value: anytype) usize { |
| 647 | 647 | indexOfSentinel(info.child, sentinel, value) |
| 648 | 648 | else |
| 649 | 649 | @compileError("length of pointer with no sentinel"), |
| 650 | | .C => indexOfSentinel(info.child, 0, value), |
| 650 | .C => { |
| 651 | assert(value != null); |
| 652 | return indexOfSentinel(info.child, 0, value); |
| 653 | }, |
| 651 | 654 | .Slice => value.len, |
| 652 | 655 | }, |
| 653 | 656 | .Struct => |info| if (info.is_tuple) { |
| ... | ... | @@ -708,7 +711,10 @@ pub fn lenZ(ptr: anytype) usize { |
| 708 | 711 | indexOfSentinel(info.child, sentinel, ptr) |
| 709 | 712 | else |
| 710 | 713 | @compileError("length of pointer with no sentinel"), |
| 711 | | .C => indexOfSentinel(info.child, 0, ptr), |
| 714 | .C => { |
| 715 | assert(ptr != null); |
| 716 | return indexOfSentinel(info.child, 0, ptr); |
| 717 | }, |
| 712 | 718 | .Slice => if (info.sentinel) |sentinel| |
| 713 | 719 | indexOfSentinel(info.child, sentinel, ptr.ptr) |
| 714 | 720 | else |