Skip to content

Struct literal of a type parameter: fn mk[T](x: T) -> T: T { v: 1 } passes Sema, then fails as invalid MIR #1982

Closed

Description

@ehartford

Found by the Sema/MIR wave (wave-sema). fn mk[T](x: T) -> T: T { v: 1 } called as mk(3) passes Sema and then fails as invalid MIR. A struct literal needs a concrete struct type; T is a type parameter with no bound that makes it constructible that way, so Sema must refuse the literal at the definition with a located error. Post-Sema invalid MIR is a compiler bug (D65). Failing-first compile_errors fixture.

Activity

  1. added
    bug
    on Oct 3, 2026
  2. ehartford commented on Oct 3, 2026

    @ehartford
    ContributorAuthor

    Fixed on main in c884c1c (stack #2001 → #2010, seed-driven battery GREEN on b932ef6, tree identical to main). Fixture coverage is in the stack's commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions