From 2d1723c0d6e3ea3f10600cac310cbf6e77867596 Mon Sep 17 00:00:00 2001 From: Marco Garten Date: Mon, 23 Mar 2026 21:25:38 -0700 Subject: [PATCH] Resolve ambiguous factory spec. with nvcc+GCC (#6011) 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 #5565. Co-authored-by: Oz --- include/pybind11/detail/init.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/pybind11/detail/init.h b/include/pybind11/detail/init.h index 56e0a56ab..a1083f845 100644 --- a/include/pybind11/detail/init.h +++ b/include/pybind11/detail/init.h @@ -367,8 +367,15 @@ template ` = `void_type()`, which the dual-factory +// specialization can also decompose as `AReturn(AArgs...)` with `AReturn=void_type` +// and `AArgs={}`. template -struct factory { +struct factory { remove_reference_t class_factory; // NOLINTNEXTLINE(google-explicit-constructor)