From 55c22889458d04b113885c429caac784c011187e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 1 May 2024 16:37:11 +0200 Subject: [PATCH] Restrict workaround to R-devel --- inst/include/cpp11/r_vector.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inst/include/cpp11/r_vector.hpp b/inst/include/cpp11/r_vector.hpp index 97494e837..29d1057b5 100644 --- a/inst/include/cpp11/r_vector.hpp +++ b/inst/include/cpp11/r_vector.hpp @@ -891,7 +891,13 @@ inline void r_vector::clear() { inline SEXP truncate(SEXP x, R_xlen_t length, R_xlen_t capacity) { // Avoid SETLENGTH() and SET_TRUELENGTH() which trigger a warning on R-devel 4.5 +#if R_VERSION >= R_Version(3, 4, 0) && R_VERSION < R_Version(4, 5, 0) + SETLENGTH(x, length); + SET_TRUELENGTH(x, capacity); + SET_GROWABLE_BIT(x); +#else x = safe[Rf_lengthgets](x, length); +#endif return x; }