Skip to content

Setting optionals to undefined defaults to null in debug mode #8333

Open
@fengb

Description

@fengb

If we do a simple undefined optional (var foo: ?u32 = undefined;), this gets converted to null only in debug mode: https://zig.godbolt.org/z/5a6ca8bz8. This is correctly set to 0xAAAA in release-safe.

This feels like a footgun as simple testing will trigger wrong assumptions.

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions