Skip to content

@bitSizeOf should error when no sensible result can be returned #4211

Open
@shawnl

Description

@shawnl

#2177 (comment)

This function measures the size at runtime. For types that are disallowed at runtime, such as
 {#syntax#}comptime_int{#endsyntax#} and {#syntax#}type{#endsyntax#}, the result is {#syntax#}0{#endsyntax#}.

I can't find a detailed reason why this is needed over erroring if we can't return a sensible result. Types are always comptime. Throwing an compile error when possible is part of the zen of zig, and prevents bugs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions