Commit 8951335
Cover all integer index types via templated operator[] on wasm
The previous patch added a `long` overload to fix `c[long]` ambiguity
on wasm32, but introduced a new ambiguity for `c[size_t]` (and any
other integer type that is not exactly R_xlen_t or long), because
the two member overloads then tie on a Conversion-rank index ICS.
Replace the single `long` overload with a SFINAE-constrained template
that accepts any integral type other than R_xlen_t and delegates to
the R_xlen_t version with an explicit cast. The template always
provides an identity match on the index, beating both the
non-template R_xlen_t overload (which requires an integral
conversion) and the built-in pointer subscript (which requires a
user-defined conversion on the object).
Compiled only when LONG_VECTOR_SUPPORT is not defined, so LP64 builds
remain unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent aed58c1 commit 8951335
2 files changed
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
347 | 354 | | |
348 | 355 | | |
349 | 356 | | |
| |||
0 commit comments