@@ -4681,48 +4681,71 @@ template <typename T>
46814681template <typename InstanceWrap<T>::InstanceVoidMethodCallback method>
46824682inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceMethod (
46834683 const char * utf8name, napi_property_attributes attributes, void * data) {
4684+ #ifdef _MSC_VER
4685+ // MSVC (as of v145 / Visual Studio 2026) raises an internal compiler error
4686+ // (C1001) when a pointer-to-member-function is used as a non-type template
4687+ // parameter, as the static compile-time dispatch below does. On MSVC, fall
4688+ // back to the runtime overload, which passes `method` as a value instead.
4689+ return InstanceMethod (utf8name, method, attributes, data);
4690+ #else
46844691 napi_property_descriptor desc = napi_property_descriptor ();
46854692 desc.utf8name = utf8name;
46864693 desc.method = details::TemplatedInstanceVoidCallback<T, method>;
46874694 desc.data = data;
46884695 desc.attributes = attributes;
46894696 return desc;
4697+ #endif
46904698}
46914699
46924700template <typename T>
46934701template <typename InstanceWrap<T>::InstanceMethodCallback method>
46944702inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceMethod (
46954703 const char * utf8name, napi_property_attributes attributes, void * data) {
4704+ #ifdef _MSC_VER
4705+ // See the note in the InstanceMethod overload above.
4706+ return InstanceMethod (utf8name, method, attributes, data);
4707+ #else
46964708 napi_property_descriptor desc = napi_property_descriptor ();
46974709 desc.utf8name = utf8name;
46984710 desc.method = details::TemplatedInstanceCallback<T, method>;
46994711 desc.data = data;
47004712 desc.attributes = attributes;
47014713 return desc;
4714+ #endif
47024715}
47034716
47044717template <typename T>
47054718template <typename InstanceWrap<T>::InstanceVoidMethodCallback method>
47064719inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceMethod (
47074720 Symbol name, napi_property_attributes attributes, void * data) {
4721+ #ifdef _MSC_VER
4722+ // See the note in the InstanceMethod overload above.
4723+ return InstanceMethod (name, method, attributes, data);
4724+ #else
47084725 napi_property_descriptor desc = napi_property_descriptor ();
47094726 desc.name = name;
47104727 desc.method = details::TemplatedInstanceVoidCallback<T, method>;
47114728 desc.data = data;
47124729 desc.attributes = attributes;
47134730 return desc;
4731+ #endif
47144732}
47154733
47164734template <typename T>
47174735template <typename InstanceWrap<T>::InstanceMethodCallback method>
47184736inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceMethod (
47194737 Symbol name, napi_property_attributes attributes, void * data) {
4738+ #ifdef _MSC_VER
4739+ // See the note in the InstanceMethod overload above.
4740+ return InstanceMethod (name, method, attributes, data);
4741+ #else
47204742 napi_property_descriptor desc = napi_property_descriptor ();
47214743 desc.name = name;
47224744 desc.method = details::TemplatedInstanceCallback<T, method>;
47234745 desc.data = data;
47244746 desc.attributes = attributes;
47254747 return desc;
4748+ #endif
47264749}
47274750
47284751template <typename T>
@@ -4768,27 +4791,37 @@ template <typename InstanceWrap<T>::InstanceGetterCallback getter,
47684791 typename InstanceWrap<T>::InstanceSetterCallback setter>
47694792inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceAccessor (
47704793 const char * utf8name, napi_property_attributes attributes, void * data) {
4794+ #ifdef _MSC_VER
4795+ // See the note in the InstanceMethod overload above.
4796+ return InstanceAccessor (utf8name, getter, setter, attributes, data);
4797+ #else
47714798 napi_property_descriptor desc = napi_property_descriptor ();
47724799 desc.utf8name = utf8name;
47734800 desc.getter = details::TemplatedInstanceCallback<T, getter>;
47744801 desc.setter = This::WrapSetter (This::SetterTag<setter>());
47754802 desc.data = data;
47764803 desc.attributes = attributes;
47774804 return desc;
4805+ #endif
47784806}
47794807
47804808template <typename T>
47814809template <typename InstanceWrap<T>::InstanceGetterCallback getter,
47824810 typename InstanceWrap<T>::InstanceSetterCallback setter>
47834811inline ClassPropertyDescriptor<T> InstanceWrap<T>::InstanceAccessor (
47844812 Symbol name, napi_property_attributes attributes, void * data) {
4813+ #ifdef _MSC_VER
4814+ // See the note in the InstanceMethod overload above.
4815+ return InstanceAccessor (name, getter, setter, attributes, data);
4816+ #else
47854817 napi_property_descriptor desc = napi_property_descriptor ();
47864818 desc.name = name;
47874819 desc.getter = details::TemplatedInstanceCallback<T, getter>;
47884820 desc.setter = This::WrapSetter (This::SetterTag<setter>());
47894821 desc.data = data;
47904822 desc.attributes = attributes;
47914823 return desc;
4824+ #endif
47924825}
47934826
47944827template <typename T>
0 commit comments