Skip to content

Commit 3239d48

Browse files
committed
Make make_caster unique_to_translation_unit.
1 parent 53e585d commit 3239d48

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/pybind11/cast.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ PYBIND11_NAMESPACE_BEGIN(detail)
3434
template <typename type, typename SFINAE = void>
3535
class type_caster : public type_caster_base<type> {};
3636

37+
namespace {
38+
struct unique_to_translation_unit {};
39+
} // namespace
40+
3741
template <typename IntrinsicType>
3842
type_caster<IntrinsicType> pybind11_select_caster(IntrinsicType *);
3943

@@ -58,7 +62,7 @@ using make_caster = make_caster_impl<intrinsic_t<type>>;
5862

5963
#else
6064

61-
template <typename type>
65+
template <typename type, typename = unique_to_translation_unit>
6266
using make_caster = decltype(pybind11_select_caster(static_cast<intrinsic_t<type> *>(nullptr)));
6367

6468
#endif

0 commit comments

Comments
 (0)