Skip to content

warning: loop variable ‘numerator’ creates a copy from type #122

Closed

Description

@cpsievert

A fix for this warning has been request by CRAN (by 2023-01-25)

Version: 0.4.4
Check: whether package can be installed
Result: WARN
    Found the following significant warnings:
     src/ast_values.cpp:484:23: warning: loop variable 'numerator' creates a copy from type 'const std::string' [-Wrange-loop-construct]
     src/ast_values.cpp:486:23: warning: loop variable 'denominator' creates a copy from type 'const std::string' [-Wrange-loop-construct]
    See ‘/data/gannet/ripley/R/packages/tests-clang/sass.Rcheck/00install.out’ for details.
    * used C compiler: ‘clang version 15.0.6’
    * used C++ compiler: ‘clang version 15.0.6’
Flavor: [r-devel-linux-x86_64-fedora-clang](https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-clang/sass-00check.html)

Activity

  1. wch commented on Jan 11, 2023

    @wch
    Collaborator

    I think this change should fix it (though I haven't tested yet):

    --- a/src/libsass/src/ast_values.cpp
    +++ b/src/libsass/src/ast_values.cpp
    @@ -481,9 +481,9 @@ namespace Sass {
       {
         if (hash_ == 0) {
           hash_ = std::hash<double>()(value_);
    -      for (const auto numerator : numerators)
    +      for (const auto& numerator : numerators)
             hash_combine(hash_, std::hash<sass::string>()(numerator));
    -      for (const auto denominator : denominators)
    +      for (const auto& denominator : denominators)
             hash_combine(hash_, std::hash<sass::string>()(denominator));
         }
         return hash_;
  2. added a commit that references this issue on Jan 11, 2023
    6cb8239
  3. cpsievert commented on Jan 11, 2023

    @cpsievert
    ContributorAuthor

    Yep, thanks, I noticed LibSass 3.6.5 addressed it in sass/libsass#3129, so I'm thinking we just update LibSass (#123)?

  4. wch commented on Jan 11, 2023

    @wch
    Collaborator

    That's a good idea. I didn't realize that we weren't on the latest version of libsass.

  5. added a commit that references this issue on Jan 12, 2023
    fe83296
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions