From e29afdd0ed4512e68025a727046facda5fe844ff Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 24 Jul 2026 14:30:37 -0700 Subject: [PATCH] Fix overload ambiguity --- src/care/host_device_ptr.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/care/host_device_ptr.h b/src/care/host_device_ptr.h index 7459c13a..94ff10f2 100644 --- a/src/care/host_device_ptr.h +++ b/src/care/host_device_ptr.h @@ -21,6 +21,7 @@ #include "chai/ManagedArray.hpp" // Std library headers +#include #include @@ -93,9 +94,16 @@ namespace care { /// /// @author Peter Robinson /// - /// nullptr constructor + /// Construct from nullptr /// - CARE_HOST_DEVICE host_device_ptr(std::nullptr_t from) noexcept : MA (from) {} + /// @note The constraint prevents overload ambiguity between this + /// constructor and the size_t constructor when constructing + /// with the integer literal 0. Additionally, the constraint + /// is a workaround for a nvcc bug where overload resolution + /// can incorrectly report an ambiguity between this constructor + /// and the size_t constructor. + /// + CARE_HOST_DEVICE host_device_ptr(std::same_as auto from) noexcept : MA (from) {} /// /// Construct from a size