Skip to content

Conversation

eddelbuettel
Copy link
Member

Brian Ripley runs his M1mac checks under clnag++ with options -Wall -pedantic -Wconversion -Wno-sign-conversion and this throws up some narrowing warnings. This minimal PR suppresses one where C++ size() returns long int and R wants an int.

Checklist

  • Code compiles correctly
  • R CMD check still passes all tests
  • Preferably, new tests were added which fail without the change
  • Document the changes by file in ChangeLog

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a narrowing warning that occurs when compiling with clang++ using strict warning flags. The issue arises because std::string_view::size() returns a size_t (which can be long int) but the R function Rf_mkCharLen() expects an int parameter.

  • Added explicit cast from size_t to int to prevent narrowing warning
  • Updated ChangeLog to document the fix

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

File Description
inst/include/Rcpp/internal/wrap.h Added explicit cast to suppress narrowing warning in make_charsexp__impl__cstring function
ChangeLog Documented the narrowing warning fix

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@Enchufa2 Enchufa2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@eddelbuettel eddelbuettel merged commit 0dc6a10 into master Sep 4, 2025
26 checks passed
@eddelbuettel eddelbuettel deleted the feature/narrowing_warning branch September 4, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants