You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
const_string_proxy comparisons are ambiguous with Apple clang (non-const operator== / operator!=) #1537
Comparing two CharacterVector::const_Proxy values does not compile with Apple clang 14 in C++20 mode, and
comparing a const_Proxy with a SEXP does not compile with Apple clang 14 or 17.
#include<Rcpp.h>// [[Rcpp::export]]boolsame(const Rcpp::CharacterVector x) {
Rcpp::CharacterVector::const_Proxy a = x[0], b = x[1];
return a == b; // ambiguous: clang 14, C++20
}
// [[Rcpp::export]]boolsx(const Rcpp::CharacterVector x, SEXP s) {
Rcpp::CharacterVector::const_Proxy a = x[0];
return a == s || a != s; // ambiguous: clang 14 and 17, C++17 and C++20
}
error: use of overloaded operator '==' is ambiguous (with operand types
'Rcpp::CharacterVector::const_Proxy' (aka 'const_string_proxy<16, Rcpp::PreserveStorage>') and
'Rcpp::CharacterVector::const_Proxy')
In inst/include/Rcpp/vector/const_string_proxy.h the const char* and const const_string_proxy&
overloads of operator== and operator!= are not declared const, while the SEXP overloads and all the corresponding operators in string_proxy.h, are.
Adding const to those four operators resolves all of the above (also in PR):
Affected CRAN packages that fail to install for this reason: comparator, IFC, IsoSpecR,
packcircles, runner.
Seen with R 4.6.1, Rcpp 1.1.2, Apple clang 14.0.3. The operators are unchanged in current Rcpp master (279801e, 1.1.2.8), where Apple clang 17.0.0 (arm64) gives the same SEXP errors but accepts same(). With the changes above the example compiles in both modes with both compilers.
Thanks, I have no doubt this helps on the systems you tested. It would be helpful if you could also toss it at a Linux version or two (in a container for overall ease) to ensure it leaves no hiccups there either (as I noted in the corresponding PR #1538 you kindly made).
Activity
eddelbuettel commentedon Nov 29, 2026
Thanks, I have no doubt this helps on the systems you tested. It would be helpful if you could also toss it at a Linux version or two (in a container for overall ease) to ensure it leaves no hiccups there either (as I noted in the corresponding PR #1538 you kindly made).
Appreciate the issue and PR.
update ChangeLog for RcppCore#1537
s-u commentedon Nov 29, 2026
GH actions worked but also tested on: