# Sema: defer extern function type validation to declaration or call · gitcafe/zig

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

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

Visibility: public

Requested revision: 07445c1f9f70ba3dfc0a63d12cd595854c89d194

Requested commit: 07445c1f9f70ba3dfc0a63d12cd595854c89d194

Commit: 07445c1f9f70ba3dfc0a63d12cd595854c89d194

Tree: 243c942df5e571ce55115a09c575900b4e1b4487

Author: Matthew Lugg

Committer: Matthew Lugg

## Message

```
Sema: defer extern function type validation to declaration or call

Because of packed structs, checking whether a type is extern-compatible
requires that its layout be resolved. For functions to do this
validation as soon as the function type is created would lead to
dependency loops in cases like '*const fn (*@This()) void callconv(.c)`.

Therefore, when creating a function *type*, we no longer perform this
check immediately, instead waiting until the function is called.

```

## Parents

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

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