Unable to evaluate comptime expression (math on slice of array)

I am debugging some comptime code. Here is a minimal reproduction:

const std = @import("std");

pub fn sumSlice(slice: []const u8) u32 {
    var sum: u32 = 0;
    for (slice) |number| {
        sum += number;
    }
    return sum;
}

pub fn makeArray(comptime num_elements: u8) [num_elements]u8 {
    var array: [num_elements]u8 = undefined;
    for (&array) |*element| {
        element.* = 2;
    }
    return array;
}

test {
    var array = makeArray(35);
    const sum = comptime sumSlice(&array);
    array[0] = 3;
    try std.testing.expectEqual(@as(u32, 70), sum);
}

Why can’t I evaluate sumSlice at comptime?

error: unable to evaluate comptime expression
    const sum = comptime sumSlice(&array);
                                  ^~~~~~

this compiles: (notice the comptime var)

const std = @import("std");

pub fn sumSlice(slice: []const u8) u32 {
    var sum: u32 = 0;
    for (slice) |number| {
        sum += number;
    }
    const sum2 = sum;
    return sum2;
}

test {
    comptime var array: [35]u8 = [1]u8{2} ** 35;
    const sum = comptime sumSlice(&array);
    array[0] = 3;
    try std.testing.expectEqual(@as(u32, 70), sum);
}

related