Skip to content

Commit 14a350a

Browse files
committed
[Windows] Fix native build failure on the VS 2026 toolset
1 parent 04822d0 commit 14a350a

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

third_party/ref-napi/src/ref_napi_bindings.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,22 @@ class PointerBuffer : public ObjectWrap<PointerBuffer> {
100100
};
101101

102102
Object PointerBuffer::Init(Napi::Env env, Object exports) {
103-
Function func =
104-
DefineClass(env, "PointerBuffer",
105-
{InstanceMethod("isNull", &PointerBuffer::IsNull),
106-
InstanceMethod("get", &PointerBuffer::Get),
107-
InstanceMethod("address", &PointerBuffer::Address),
108-
InstanceMethod("toString", &PointerBuffer::ToString),
109-
InstanceMethod("copy", &PointerBuffer::Copy),
110-
InstanceMethod("slice", &PointerBuffer::Slice),
111-
InstanceAccessor<&PointerBuffer::Length>("length")});
103+
Function func = DefineClass(
104+
env, "PointerBuffer",
105+
{InstanceMethod("isNull", &PointerBuffer::IsNull),
106+
InstanceMethod("get", &PointerBuffer::Get),
107+
InstanceMethod("address", &PointerBuffer::Address),
108+
InstanceMethod("toString", &PointerBuffer::ToString),
109+
InstanceMethod("copy", &PointerBuffer::Copy),
110+
InstanceMethod("slice", &PointerBuffer::Slice),
111+
// Use the runtime InstanceAccessor(name, getter, setter)
112+
// overload rather than the templated
113+
// InstanceAccessor<&Fn>() form: the latter's constexpr
114+
// member-pointer template argument triggers an MSVC
115+
// Internal Compiler Error (C1001) on the VS 2026 (v18)
116+
// toolset used by the windows-2025 CI runner. This form
117+
// is equivalent and compiles cleanly on every platform.
118+
InstanceAccessor("length", &PointerBuffer::Length, nullptr)});
112119

113120
exports.Set("PointerBuffer", func);
114121
InstanceData* data = InstanceData::Get(env);

0 commit comments

Comments
 (0)