Skip to content

runtime initialized sentinel-terminated array literal fails to initialize sentinel value #4372

Closed
@andrewrk

Description

@andrewrk
const std = @import("std");

test "runtime initialized sentinel-terminated array literal" {
    var c: u16 = 300;
    const f = &[_:0x9999]u16{c};
    const g = @ptrCast(*[4]u8, f);
    std.testing.expect(g[2] == 0x99);
    std.testing.expect(g[3] == 0x99);
}

Test case fails. Should pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstage1The process of building from source via WebAssembly and the C backend.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions