Skip to content

compile error to array multiply slice literal with string literal #24173

Open
@nektro

Description

@nektro

Zig Version

0.15.0-dev.784+4a02e080d

Steps to Reproduce and Observed Behavior

pub fn main() void {
    foo(&.{"abc"} ** 8);
}

fn foo(input: []const []const u8) void {
    _ = input;
}
$ ./build/stage3/bin/zig run ./test.zig 
test.zig:2:9: error: expected indexable; found '*const struct { comptime *const [3:0]u8 = "abc" }'
    foo(&.{"abc"} ** 8);
        ^~~~~~~~~
referenced by:
    callMain [inlined]: lib/std/start.zig:666:22
    callMainWithArgs [inlined]: lib/std/start.zig:635:20
    posixCallMainAndExit: lib/std/start.zig:590:36

Expected Behavior

successful run

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions