Commit 3c5df58
authored
[Windows] Fix native build failure on the VS 2026 toolset (#1539)
The `windows-2025` GitHub Actions runner provisions Visual Studio 2026 (v18) alongside VS 2022, and `gha-setup-vsdevenv` selects the newest install via `vswhere -latest`. The v18 `constexpr` evaluator crashes with an Internal Compiler Error (C1001) while instantiating node-addon-api's templated `InstanceAccessor<&Fn>()` helper (`napi-inl.h`), which takes the getter as a `constexpr` member-pointer template argument.
Replace the templated accessor with the equivalent runtime overload in `ref-napi`'s `PointerBuffer::Init`:
- `InstanceAccessor<&PointerBuffer::Length>("length")`
+ `InstanceAccessor("length", &PointerBuffer::Length, nullptr)`
The runtime overload passes the getter as a plain function pointer and the setter as `nullptr`, preserving the read-only `length` accessor exactly while avoiding the `constexpr` template path that trips the ICE. This compiles cleanly on every platform/toolset and is a no-op at runtime.
Fix: #15381 parent 04822d0 commit 3c5df58
1 file changed
Lines changed: 16 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
112 | 119 | | |
113 | 120 | | |
114 | 121 | | |
| |||
0 commit comments