Skip to content

Remove static from namespace-scope function templates - #99

Open
lucascolley wants to merge 1 commit into
Tessil:masterfrom
lucascolley:fix-unused-template
Open

lucascolley wants to merge 1 commit into
Tessil:masterfrom
lucascolley:fix-unused-template

Conversation

@lucascolley

Copy link
Copy Markdown

Namespace-scope static in a header gives each translation unit its own internal-linkage copy, which triggers clang's -Wunused-template in TUs that don't use them. Function templates don't need static to avoid ODR violations.

Fixes #98

FYI @wjakob I'm hitting this on the PR to use nanobind in SciPy at scipy/scipy#26108

Fix drafted with claude code

Namespace-scope `static` in a header gives each translation unit its own
internal-linkage copy, which triggers clang's -Wunused-template in TUs
that don't use them. Function templates don't need `static` to avoid
ODR violations.

Fixes Tessil#98

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unused function template warnings

1 participant