Commit 158c1a1
committed
Fix ambiguous Vector::operator[] on platforms without LONG_VECTOR_SUPPORT
On wasm32 (and other platforms where LONG_VECTOR_SUPPORT is not
defined) R_xlen_t is int while ptrdiff_t is long. Subscripting an
Rcpp::Vector with a long index then becomes ambiguous between the
member operator[] (which needs a long -> int conversion on the index)
and the built-in pointer subscript operator[](SEXPREC*, ptrdiff_t)
synthesised via the implicit Vector -> SEXP conversion (which needs a
user-defined conversion on the object but matches the index exactly).
The two implicit conversion sequences are mutually unrankable so
overload resolution fails.1 parent 8d2f8f8 commit 158c1a1
2 files changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | 7 | | |
3 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
337 | 338 | | |
338 | 339 | | |
339 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
340 | 355 | | |
341 | 356 | | |
342 | 357 | | |
| |||
0 commit comments