Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shadow parameter warning #1936

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

jfsimoneau
Copy link
Contributor

Compiling on Ubuntu 22.04, I get a shadow parameter warning. Since we treat all warnings as errors, it fails our build.

[...]/cpp-httplib/httplib.h: In lambda function:
[...]/cpp-httplib/httplib.h:353:37: error: declaration of ‘char b’ shadows a parameter [-Werror=shadow]
  353 |                     [](char a, char b) { return to_lower(a) == to_lower(b); });
      |                                ~~~~~^
[...]/cpp-httplib/httplib.h:350:60: note: shadowed declaration is here
  350 | inline bool equal(const std::string &a, const std::string &b) {
      |                                         ~~~~~~~~~~~~~~~~~~~^
[...]/cpp-httplib/httplib.h:353:29: error: declaration of ‘char a’ shadows a parameter [-Werror=shadow]
  353 |                     [](char a, char b) { return to_lower(a) == to_lower(b); });
      |                        ~~~~~^
[...]/cpp-httplib/httplib.h:350:38: note: shadowed declaration is here
  350 | inline bool equal(const std::string &a, const std::string &b) {
      |                   ~~~~~~~~~~~~~~~~~~~^
cc1plus: all warnings being treated as errors

@yhirose yhirose merged commit 932b1cb into yhirose:master Sep 12, 2024
3 of 4 checks passed
@yhirose
Copy link
Owner

yhirose commented Sep 12, 2024

Thanks!

@jfsimoneau jfsimoneau deleted the fix-shadow-parameter-warning branch October 1, 2024 17:04
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