// A many-pointer `[*]T` carries NO length, so it cannot coerce to a slice `[]T`
// implicitly — doing so would pass a bare 8-byte pointer where a 16-byte
// `{ptr,len}` fat pointer is expected, silently corrupting the callee's view of
// the data (garbage length, mis-aligned element reads). The compiler rejects it
// loudly and tells the user to supply the length via `ptr[0..len]`.
//
// Regression (issue 0141): this silent mis-coercion segfaulted the comptime VM
// and failed LLVM verification at runtime; it now produces a clean diagnostic.
#import "modules/std.sx";

sum :: (s: []i64) -> i64 {
    total := 0;
    for s (x) { total += x; }
    return total;
}

main :: () -> i32 {
    xs : List(i64) = .{};
    xs.append(10);
    xs.append(20);
    r := sum(xs.items);   // [*]i64 → []i64 — needs xs.items[0..xs.len]
    print("{}\n", r);
    return 0;
}
