Skip to content

Sema accepts extern "C" fn() -> [T; N]: a C function pointer cannot return an array #1975

Closed

Description

@ehartford

Found by the #1817 work (wave-cimport, 0511025). The native backend accepts let f: extern "C" fn() -> [u16; 2] = arr and emit-c refuses it loudly, because no C function type can return an array (C11 6.7.6.3p1). A type the C ABI cannot express must not exist: Sema should reject an extern "C" fn type whose return (or parameter) is an array, naming the fix (return a struct wrapping the array, or take an out-pointer). Failing-first: a compile_errors fixture with that binding; today it checks ok.

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