Skip to content

Compiler crash when generated struct includes field of generated type from fn containing undeclared identifier #1483

Closed
@tgschultz

Description

@tgschultz
const std = @import("std");
const math = std.math;

pub fn Gen(comptime val: u32) type
{
    const UType = @IntType(false, math.ceil(val));

    const S = struct
    {
        code_len: UType,
    };
    return S;
}

test "Crash"
{
    const G = Gen(8);
}

I haven't been able to minimize the circumstances further than the above. As you can see, math.ceil is passed an incorrect type and should produce an error message communicating that. For some reason, this specific construction instead causes a compiler crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions