# Sema: fix closure capture typeof runtime-known parameter · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/bcf2eb1a003d076c166d4ce9cba20f6ed9b53887)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: bcf2eb1a003d076c166d4ce9cba20f6ed9b53887

Requested commit: bcf2eb1a003d076c166d4ce9cba20f6ed9b53887

Commit: bcf2eb1a003d076c166d4ce9cba20f6ed9b53887

Tree: 0703024c1c2d2601cd0eee38ac729d01027c8857

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: fix closure capture typeof runtime-known parameter

Closures are not necessarily constant values. For example, Zig
code might do something like this:

    fn foo(x: anytype) void {
        const S = struct {field: @TypeOf(x)};
    }

...in which case the closure_capture instruction has access to a
runtime value only. In such case we preserve the type and use a
dummy runtime value.

closes #11292

```

## Parents

- [b802a67562cc912213ebfc6ef8a380c775c999fe](https://git.cafe/gitcafe/zig/commit/b802a67562cc912213ebfc6ef8a380c775c999fe?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/bcf2eb1a003d076c166d4ce9cba20f6ed9b53887?format=markdown)
