Resolve ambiguous factory specialization with nvcc+GCC#6011
Merged
rwgk merged 1 commit intopybind:masterfrom Mar 24, 2026
Merged
Resolve ambiguous factory specialization with nvcc+GCC#6011rwgk merged 1 commit intopybind:masterfrom
rwgk merged 1 commit intopybind:masterfrom
Conversation
Explicitly specify the 4th template parameter in the single-factory partial specialization of `factory` to disambiguate it from the dual-factory specialization when compiled with nvcc + GCC 14. Fixes pybind#5565. Co-Authored-By: Oz <oz-agent@warp.dev>
rwgk
approved these changes
Mar 24, 2026
Collaborator
rwgk
left a comment
There was a problem hiding this comment.
Looks good to my agent :-)
Verdict: One-line fix, good explanatory comment, fixes a real compilation issue on CUDA + GCC 14. The commit is co-authored with an AI agent (Oz/Warp). Looks straightforward and correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #5565 and BLAST-WarpX/warpx#6702.
When compiling with nvcc + GCC 14, the single-factory specialization
factory<Func, void_type (*)(), Return(Args...)>and the dual-factoryspecialization
factory<CFunc, AFunc, CReturn(CArgs...), AReturn(AArgs...)>are considered ambiguous by the compiler. The single-factory spec only
specifies 3 of 4 template parameters (the 4th defaults to
void_type()),while the dual-factory spec decomposes all 4 — so neither is strictly
more specialized than the other.
The fix explicitly specifies the 4th parameter as
void_type()in thesingle-factory specialization, making it unambiguously more specialized.
Suggested changelog entry:
factorytemplate specialization indetail/init.hthat caused compilation failure with nvcc + GCC 14.
#5565 <https://github.com/pybind/pybind11/issues/5565>_