Skip to content

Commit

Permalink
Add a note about extern and scopes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmeow committed Aug 21, 2024
1 parent 1c94734 commit 9822f8b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/design/declaring_entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- [Matching redeclarations of an entity](#matching-redeclarations-of-an-entity)
- [Details](#details)
- [`extern` and `extern library`](#extern-and-extern-library)
- [Valid scopes for `extern`](#valid-scopes-for-extern)
- [Effect on indirect imports](#effect-on-indirect-imports)
- [Alternatives considered](#alternatives-considered)
- [References](#references)
Expand Down Expand Up @@ -151,6 +152,11 @@ extern fn MyClassFactory(val: i32) -> MyClass* {
}
```

### Valid scopes for `extern`

The `extern` modifier is only valid on namespace-scoped entities, including in
the file scope. In other words, `class C { extern fn F(); }` is invalid.

### Effect on indirect imports

Indirect imports won't see the definition of an `extern` entity. We expect this
Expand Down

0 comments on commit 9822f8b

Please sign in to comment.